mirror of
https://github.com/dylanaraps/neofetch.git
synced 2025-10-04 17:09:21 +00:00
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
bd0f396305 | ||
|
3c03c47f50 | ||
|
b628ec0f4d | ||
|
6c238a03b2 |
57
CHANGELOG.md
57
CHANGELOG.md
@@ -14,62 +14,25 @@
|
|||||||
- Fixed detection bug with TrueOS. [**@dawidd6**](https://github.com/dawidd6)
|
- Fixed detection bug with TrueOS. [**@dawidd6**](https://github.com/dawidd6)
|
||||||
- Added support for macOS High Sierra. [**@yslgirl**](https://github.com/yslgirl)
|
- Added support for macOS High Sierra. [**@yslgirl**](https://github.com/yslgirl)
|
||||||
- Added support for Container Linux by CoreOS. [**@chrisweeksnz**](https://github.com/chrisweeksnz)
|
- Added support for Container Linux by CoreOS. [**@chrisweeksnz**](https://github.com/chrisweeksnz)
|
||||||
- Added support for 2017 iOS devices. [**@iandrewt**](https://github.com/iandrewt)
|
- Added support for 2017 iOS devices [**@iandrewt**](https://github.com/iandrewt)
|
||||||
- Added support for LEDE. [**@dawidd6**](https://github.com/dawidd6)
|
- Added support for LEDE. [**@dawidd6**](https://github.com/dawidd6)
|
||||||
- Added support for Pop!\_OS. [**@jliles**](https://github.com/jliles)
|
|
||||||
- Added support for Lunar Linux.
|
|
||||||
|
|
||||||
|
|
||||||
## General
|
|
||||||
|
|
||||||
- Added more info to verbose mode for debugging.
|
|
||||||
- Fixed bug in prompt location calculation.
|
|
||||||
|
|
||||||
|
|
||||||
## Ascii
|
|
||||||
|
|
||||||
- Added color updates for Kubuntu logo. **Maulik Mistry**
|
|
||||||
|
|
||||||
|
|
||||||
## Images
|
## Images
|
||||||
|
|
||||||
- [MacOS/iTerm2] Fixed thumbnail not appearing. [**@StarryTony**](https://github.com/StarryTony)
|
- [MacOS/iTerm2] Fixed thumbnail not appearing (replaced by placeholder) [**@StarryTony**](https://github.com/StarryTony)
|
||||||
- Fixed bug with getting wallpaper from feh.
|
|
||||||
- Added `pixterm` backend.
|
|
||||||
|
|
||||||
## Info
|
## Info
|
||||||
|
|
||||||
**Desktop Environment**
|
|
||||||
|
|
||||||
- Added GNOME version.
|
|
||||||
|
|
||||||
**Window Manager**
|
**Window Manager**
|
||||||
|
|
||||||
- Added support for most (*if not all*) current Wayland compositors/window manager's.
|
- [macOS] Fixed chunkwm being detected as Kwm. [**@iandrewt**](https://github.com/iandrewt)
|
||||||
- [macOS] Fixed `chunkwm` being detected as `Kwm`. [**@iandrewt**](https://github.com/iandrewt)
|
|
||||||
|
|
||||||
**Window Manager Theme**
|
|
||||||
|
|
||||||
- Fixed `sawfish` detection.
|
|
||||||
|
|
||||||
**Install Date**
|
**Install Date**
|
||||||
|
|
||||||
- [macOS] Fixed Install Date. [**@iandrewt**](https://github.com/iandrewt)
|
- [macOS] Fixed Install Date. [**@iandrewt**](https://github.com/iandrewt)
|
||||||
|
|
||||||
**Theme**
|
|
||||||
|
|
||||||
- Fixed KDE font issue. [**@mstraube**](https://github.com/mstraube)
|
|
||||||
|
|
||||||
**CPU**
|
|
||||||
|
|
||||||
- [linux] Detect the correct temperature file to use.
|
|
||||||
- [windows] Removed `$temp` usage as it's an envar.
|
|
||||||
|
|
||||||
**GPU**
|
|
||||||
|
|
||||||
- [linux] Added driver version to NVIDIA output.
|
|
||||||
- [macOS] Added NVIDIA support. [**@iandrewt**](https://github.com/iandrewt)
|
|
||||||
|
|
||||||
**Package Manager**
|
**Package Manager**
|
||||||
|
|
||||||
- Added detection for Sabotage Linux's `butch` [**@MitchWeaver**](https://github.com/MitchWeaver)
|
- Added detection for Sabotage Linux's `butch` [**@MitchWeaver**](https://github.com/MitchWeaver)
|
||||||
@@ -77,15 +40,3 @@
|
|||||||
**Resolution**
|
**Resolution**
|
||||||
|
|
||||||
- [macOS] Fixed errors on non-retina screens. [**@iandrewt**](https://github.com/iandrewt)
|
- [macOS] Fixed errors on non-retina screens. [**@iandrewt**](https://github.com/iandrewt)
|
||||||
|
|
||||||
**Song**
|
|
||||||
|
|
||||||
- Added support for Elisa. [**@mstraube**](https://github.com/mstraube)
|
|
||||||
|
|
||||||
**Model**
|
|
||||||
|
|
||||||
- Remove more unneeded outputs. [**@konimex**](https://github.com/konimex)
|
|
||||||
|
|
||||||
**Disk**
|
|
||||||
|
|
||||||
- Update Haiku's detection. [**@dawidd6**](https://github.com/dawidd6)
|
|
||||||
|
@@ -543,7 +543,7 @@ disk_display="off"
|
|||||||
# Image backend.
|
# Image backend.
|
||||||
#
|
#
|
||||||
# Default: 'ascii'
|
# Default: 'ascii'
|
||||||
# Values: 'ascii', 'caca', 'catimg', 'jp2a', 'iterm2', 'off', 'termpix', 'pixterm', 'tycat', 'w3m'
|
# Values: 'ascii', 'caca', 'catimg', 'jp2a', 'iterm2', 'off', 'tycat', 'w3m'
|
||||||
# Flag: --backend
|
# Flag: --backend
|
||||||
image_backend="ascii"
|
image_backend="ascii"
|
||||||
|
|
||||||
@@ -617,18 +617,8 @@ image_loop="off"
|
|||||||
# Values: 'dir'
|
# Values: 'dir'
|
||||||
thumbnail_dir="${XDG_CACHE_HOME:-${HOME}/.cache}/thumbnails/neofetch"
|
thumbnail_dir="${XDG_CACHE_HOME:-${HOME}/.cache}/thumbnails/neofetch"
|
||||||
|
|
||||||
# Crop mode
|
|
||||||
#
|
|
||||||
# Default: 'normal'
|
|
||||||
# Values: 'normal', 'fit', 'fill'
|
|
||||||
# Flag: --crop_mode
|
|
||||||
#
|
|
||||||
# See this wiki page to learn about the fit and fill options.
|
|
||||||
# https://github.com/dylanaraps/neofetch/wiki/What-is-Waifu-Crop%3F
|
|
||||||
crop_mode="normal"
|
|
||||||
|
|
||||||
# Crop offset
|
# Crop offset
|
||||||
# Note: Only affects 'normal' crop mode.
|
# Note: Only affects 'square' image size.
|
||||||
#
|
#
|
||||||
# Default: 'center'
|
# Default: 'center'
|
||||||
# Values: 'northwest', 'north', 'northeast', 'west', 'center'
|
# Values: 'northwest', 'north', 'northeast', 'west', 'center'
|
||||||
@@ -637,20 +627,21 @@ crop_mode="normal"
|
|||||||
crop_offset="center"
|
crop_offset="center"
|
||||||
|
|
||||||
# Image size
|
# Image size
|
||||||
# The image is half the terminal width by default.
|
# NOTE: 'square' is the OLD behavior.
|
||||||
|
# NOTE: 'auto' keeps image aspect ratio and size where possible.
|
||||||
#
|
#
|
||||||
# Default: 'auto'
|
# Default: 'auto'
|
||||||
# Values: 'auto', '00px', '00%', 'none'
|
# Values: 'auto', 'square'
|
||||||
# Flags: --image_size
|
# Flags: --image_size
|
||||||
# --size
|
# --size
|
||||||
image_size="auto"
|
image_size="auto"
|
||||||
|
|
||||||
# Ggap between image and text
|
# Gap between image and text
|
||||||
#
|
#
|
||||||
# Default: '3'
|
# Default: '4'
|
||||||
# Values: 'num', '-num'
|
# Values: 'num', '-num'
|
||||||
# Flag: --gap
|
# Flag: --gap
|
||||||
gap=3
|
gap=4
|
||||||
|
|
||||||
# Image offsets
|
# Image offsets
|
||||||
# Only works with the w3m backend.
|
# Only works with the w3m backend.
|
||||||
|
189
neofetch
189
neofetch
@@ -114,8 +114,7 @@ get_distro() {
|
|||||||
elif type -p tazpkg >/dev/null; then
|
elif type -p tazpkg >/dev/null; then
|
||||||
distro="SliTaz $(< /etc/slitaz-release)"
|
distro="SliTaz $(< /etc/slitaz-release)"
|
||||||
|
|
||||||
elif type -p kpt >/dev/null && \
|
elif type -p kpm > /dev/null; then
|
||||||
type -p kpm >/dev/null; then
|
|
||||||
distro="KSLinux"
|
distro="KSLinux"
|
||||||
|
|
||||||
elif [[ -d "/system/app/" && -d "/system/priv-app" ]]; then
|
elif [[ -d "/system/app/" && -d "/system/priv-app" ]]; then
|
||||||
@@ -488,6 +487,9 @@ get_packages() {
|
|||||||
type -p dpkg >/dev/null && \
|
type -p dpkg >/dev/null && \
|
||||||
packages="$((packages+=$(dpkg --get-selections | grep -cv deinstall$)))"
|
packages="$((packages+=$(dpkg --get-selections | grep -cv deinstall$)))"
|
||||||
|
|
||||||
|
type -p kpm >/dev/null && \
|
||||||
|
packages="$((packages+=$(kpm --get-selections | grep -cv deinstall$)))"
|
||||||
|
|
||||||
type -p pkgtool >/dev/null && \
|
type -p pkgtool >/dev/null && \
|
||||||
packages="$((packages+=$(ls -1 /var/log/packages | wc -l)))"
|
packages="$((packages+=$(ls -1 /var/log/packages | wc -l)))"
|
||||||
|
|
||||||
@@ -545,10 +547,6 @@ get_packages() {
|
|||||||
type -p alps >/dev/null && \
|
type -p alps >/dev/null && \
|
||||||
packages="$((packages+=$(alps showinstalled | wc -l)))"
|
packages="$((packages+=$(alps showinstalled | wc -l)))"
|
||||||
|
|
||||||
type -p kpt >/dev/null && \
|
|
||||||
type -p kpm >/dev/null && \
|
|
||||||
packages="$((packages+=$(kpm --get-selections | grep -cv deinstall$)))"
|
|
||||||
|
|
||||||
if type -p cave >/dev/null; then
|
if type -p cave >/dev/null; then
|
||||||
package_dir=(/var/db/paludis/repositories/{cross-installed,installed}/*/data/*)
|
package_dir=(/var/db/paludis/repositories/{cross-installed,installed}/*/data/*)
|
||||||
packages="$((packages+=$(ls -d -1 "${package_dir[@]}" | wc -l)))"
|
packages="$((packages+=$(ls -d -1 "${package_dir[@]}" | wc -l)))"
|
||||||
@@ -668,9 +666,6 @@ get_de() {
|
|||||||
|
|
||||||
elif [[ "$MATE_DESKTOP_SESSION_ID" ]]; then
|
elif [[ "$MATE_DESKTOP_SESSION_ID" ]]; then
|
||||||
de="MATE"
|
de="MATE"
|
||||||
|
|
||||||
elif [[ "$TDE_FULL_SESSION" ]]; then
|
|
||||||
de="Trinity"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# When a window manager is started from a display manager
|
# When a window manager is started from a display manager
|
||||||
@@ -682,12 +677,13 @@ get_de() {
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
# Fallback to using xprop.
|
# Fallback to using xprop.
|
||||||
[[ "$DISPLAY" && -z "$de" ]] && \
|
[[ -n "$DISPLAY" && -z "$de" ]] && \
|
||||||
de="$(xprop -root | awk '/KDE_SESSION_VERSION|^_MUFFIN|xfce4|xfce5/')"
|
de="$(xprop -root | awk '/KDE_SESSION_VERSION|^_MUFFIN|xfce4|xfce5/')"
|
||||||
|
|
||||||
# Format strings.
|
# Format strings.
|
||||||
case "$de" in
|
case "$de" in
|
||||||
"KDE_SESSION_VERSION"*) de="KDE${de/* = }" ;;
|
"KDE_SESSION_VERSION"*) de="KDE${de/* = }" ;;
|
||||||
|
*"TDE_FULL_SESSION"*) de="Trinity" ;;
|
||||||
*"MUFFIN"* | "Cinnamon") de="$(cinnamon --version)"; de="${de:-Cinnamon}" ;;
|
*"MUFFIN"* | "Cinnamon") de="$(cinnamon --version)"; de="${de:-Cinnamon}" ;;
|
||||||
*"xfce4"*) de="Xfce4" ;;
|
*"xfce4"*) de="Xfce4" ;;
|
||||||
*"xfce5"*) de="Xfce5" ;;
|
*"xfce5"*) de="Xfce5" ;;
|
||||||
@@ -707,37 +703,21 @@ get_wm() {
|
|||||||
# If function was run, stop here.
|
# If function was run, stop here.
|
||||||
((wm_run == 1)) && return
|
((wm_run == 1)) && return
|
||||||
|
|
||||||
if [[ "$WAYLAND_DISPLAY" ]]; then
|
if [[ -n "$DISPLAY" && "$os" != "Mac OS X" ]]; then
|
||||||
wm="$(ps -e | grep -m 1 -o -F \
|
|
||||||
-e "asc" \
|
|
||||||
-e "fireplace" \
|
|
||||||
-e "grefsen" \
|
|
||||||
-e "mazecompositor" \
|
|
||||||
-e "maynard" \
|
|
||||||
-e "motorcar" \
|
|
||||||
-e "orbment" \
|
|
||||||
-e "orbital" \
|
|
||||||
-e "perceptia" \
|
|
||||||
-e "rustland" \
|
|
||||||
-e "sway" \
|
|
||||||
-e "velox" \
|
|
||||||
-e "wavy" \
|
|
||||||
-e "wayhouse" \
|
|
||||||
-e "way-cooler" \
|
|
||||||
-e "westford" \
|
|
||||||
-e "weston")"
|
|
||||||
|
|
||||||
elif [[ "$DISPLAY" && "$os" != "Mac OS X" ]]; then
|
|
||||||
id="$(xprop -root -notype _NET_SUPPORTING_WM_CHECK)"
|
id="$(xprop -root -notype _NET_SUPPORTING_WM_CHECK)"
|
||||||
id="${id##* }"
|
id="${id##* }"
|
||||||
wm="$(xprop -id "$id" -notype -len 100 -f _NET_WM_NAME 8t)"
|
wm="$(xprop -id "$id" -notype -len 100 -f _NET_WM_NAME 8t)"
|
||||||
wm="${wm/*WM_NAME = }"
|
wm="${wm/*_NET_WM_NAME = }"
|
||||||
wm="${wm/\"}"
|
wm="${wm/\"}"
|
||||||
wm="${wm/\"*}"
|
wm="${wm/\"*}"
|
||||||
|
|
||||||
# Window Maker does not set _NET_WM_NAME
|
# Window Maker does not set _NET_WM_NAME
|
||||||
[[ "$wm" =~ "WINDOWMAKER" ]] && wm="wmaker"
|
[[ "$wm" =~ "WINDOWMAKER" ]] && wm="wmaker"
|
||||||
|
|
||||||
|
# Fallback for Wayland wms.
|
||||||
|
[[ "$wm" == "xwlc" ]] && \
|
||||||
|
wm="$(ps -e | grep -m 1 -o -F -e "sway" -e "orbment" -e "velox" -e "orbital")"
|
||||||
|
|
||||||
else
|
else
|
||||||
case "$os" in
|
case "$os" in
|
||||||
"Mac OS X")
|
"Mac OS X")
|
||||||
@@ -753,13 +733,11 @@ get_wm() {
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
"Windows")
|
"Windows")
|
||||||
wm="$(tasklist | grep -m 1 -o -F \
|
wm="$(tasklist | grep -m 1 -o -F -e "bugn" \
|
||||||
-e "bugn" \
|
|
||||||
-e "Windawesome" \
|
-e "Windawesome" \
|
||||||
-e "blackbox" \
|
-e "blackbox" \
|
||||||
-e "emerge" \
|
-e "emerge" \
|
||||||
-e "litestep")"
|
-e "litestep")"
|
||||||
|
|
||||||
[[ "$wm" == "blackbox" ]] && wm="bbLean (Blackbox)"
|
[[ "$wm" == "blackbox" ]] && wm="bbLean (Blackbox)"
|
||||||
wm="${wm:+$wm, }Explorer"
|
wm="${wm:+$wm, }Explorer"
|
||||||
;;
|
;;
|
||||||
@@ -1212,7 +1190,7 @@ get_gpu() {
|
|||||||
# Read GPUs into array.
|
# Read GPUs into array.
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
gpus=($(lspci -mm | awk -F '\\"|\\" \\"|\\(' \
|
gpus=($(lspci -mm | awk -F '\\"|\\" \\"|\\(' \
|
||||||
'/"Display|"3D|"VGA/ {a[$0] = $1 $3 " " $4} END{for(i in a)
|
'/"Display|"3D|"VGA/ {a[$0] = $3 " " $4} END{for(i in a)
|
||||||
{if(!seen[a[i]]++) print a[i]}}'))
|
{if(!seen[a[i]]++) print a[i]}}'))
|
||||||
IFS="$old_ifs"
|
IFS="$old_ifs"
|
||||||
|
|
||||||
@@ -1244,16 +1222,9 @@ get_gpu() {
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
*"intel"*)
|
*"intel"*)
|
||||||
# (sorry)
|
|
||||||
freq="$(< /sys/devices/pci0000:00/0000:\
|
|
||||||
"${gpu/ *}"/drm/card0/gt_cur_freq_mhz)"
|
|
||||||
|
|
||||||
type -p glxinfo >/dev/null && \
|
|
||||||
gpu="$(glxinfo | grep "Device:.*Intel")"
|
gpu="$(glxinfo | grep "Device:.*Intel")"
|
||||||
|
|
||||||
gpu="${gpu/*Intel/Intel}"
|
gpu="${gpu/*Intel/Intel}"
|
||||||
gpu="${gpu/'(R)'}"
|
gpu="${gpu/'(R)'}"
|
||||||
gpu="${gpu/'Corporation'}"
|
|
||||||
gpu="${gpu/ \(*}"
|
gpu="${gpu/ \(*}"
|
||||||
|
|
||||||
[[ -z "$(trim "$gpu")" ]] && gpu="Intel Integrated Graphics"
|
[[ -z "$(trim "$gpu")" ]] && gpu="Intel Integrated Graphics"
|
||||||
@@ -1270,8 +1241,7 @@ get_gpu() {
|
|||||||
gpu="${gpu/Intel }"
|
gpu="${gpu/Intel }"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
prin "${subtitle:+${subtitle}${gpu_name}}" "$gpu ${freq:+@ ${freq}Mhz}"
|
prin "${subtitle:+${subtitle}${gpu_name}}" "$gpu"
|
||||||
|
|
||||||
((++gpu_num))
|
((++gpu_num))
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -1661,7 +1631,7 @@ get_style() {
|
|||||||
# Fix weird output when the function is run multiple times.
|
# Fix weird output when the function is run multiple times.
|
||||||
unset gtk2_theme gtk3_theme theme path
|
unset gtk2_theme gtk3_theme theme path
|
||||||
|
|
||||||
if [[ "$DISPLAY" && "$os" != "Mac OS X" ]]; then
|
if [[ -n "$DISPLAY" && "$os" != "Mac OS X" ]]; then
|
||||||
# Get DE if user has disabled the function.
|
# Get DE if user has disabled the function.
|
||||||
((de_run != 1)) && get_de
|
((de_run != 1)) && get_de
|
||||||
|
|
||||||
@@ -2404,8 +2374,7 @@ image_backend() {
|
|||||||
"ascii") get_ascii ;;
|
"ascii") get_ascii ;;
|
||||||
"off") image_backend="off" ;;
|
"off") image_backend="off" ;;
|
||||||
|
|
||||||
"caca" | "catimg" | "jp2a" | "iterm2" | "termpix" |\
|
"caca" | "catimg" | "jp2a" | "iterm2" | "termpix" | "tycat" | "w3m" | "sixel")
|
||||||
"tycat" | "w3m" | "sixel" | "pixterm")
|
|
||||||
get_image_source
|
get_image_source
|
||||||
|
|
||||||
if [[ ! -f "$image" ]]; then
|
if [[ ! -f "$image" ]]; then
|
||||||
@@ -2431,7 +2400,7 @@ image_backend() {
|
|||||||
*)
|
*)
|
||||||
err "Image: Unknown image backend specified '$image_backend'."
|
err "Image: Unknown image backend specified '$image_backend'."
|
||||||
err "Image: Valid backends are: 'ascii', 'caca', 'catimg', 'jp2a', 'iterm2',
|
err "Image: Valid backends are: 'ascii', 'caca', 'catimg', 'jp2a', 'iterm2',
|
||||||
'off', 'sixel', 'pixterm', 'termpix', 'tycat', 'w3m')"
|
'off', 'sixel', 'termpix', 'tycat', 'w3m')"
|
||||||
err "Image: Falling back to ascii mode."
|
err "Image: Falling back to ascii mode."
|
||||||
get_ascii
|
get_ascii
|
||||||
;;
|
;;
|
||||||
@@ -2698,50 +2667,32 @@ get_image_size() {
|
|||||||
font_width="$((term_width / columns))"
|
font_width="$((term_width / columns))"
|
||||||
font_height="$((term_height / lines))"
|
font_height="$((term_height / lines))"
|
||||||
|
|
||||||
case "$image_size" in
|
# Get image size.
|
||||||
"auto")
|
|
||||||
image_size="$((columns * font_width / 2))"
|
|
||||||
term_height="$((term_height - term_height / 4))"
|
|
||||||
|
|
||||||
((term_height < image_size)) && \
|
|
||||||
image_size="$term_height"
|
|
||||||
;;
|
|
||||||
|
|
||||||
*"%")
|
|
||||||
percent="${image_size/\%}"
|
|
||||||
image_size="$((percent * term_width / 100))"
|
|
||||||
|
|
||||||
(((percent * term_height / 50) < image_size)) && \
|
|
||||||
image_size="$((percent * term_height / 100))"
|
|
||||||
;;
|
|
||||||
|
|
||||||
"none")
|
|
||||||
# Get image size so that we can do a better crop.
|
|
||||||
size="$(identify -format "%w %h" "$image")"
|
size="$(identify -format "%w %h" "$image")"
|
||||||
width="${size%% *}"
|
width="${size%% *}"
|
||||||
height="${size##* }"
|
height="${size##* }"
|
||||||
crop_mode="none"
|
|
||||||
|
|
||||||
while (( "$width" >= ("$term_width" / 2) ||
|
case "$image_size" in
|
||||||
"$height" >= "$term_height" )); do
|
"square")
|
||||||
width="$((width / 2))"
|
width="$((columns * font_width / 2))"
|
||||||
height="$((height / 2))"
|
height="$width"
|
||||||
done
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*) image_size="${image_size/px}" ;;
|
*)
|
||||||
|
while (( width >= (term_width / 2) ||
|
||||||
|
height >= (term_height / 2) )); do
|
||||||
|
width="$((width * 10 / 15))"
|
||||||
|
height="$((height * 10 / 15))"
|
||||||
|
done
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
width="${width:-$image_size}"
|
|
||||||
height="${height:-$image_size}"
|
|
||||||
|
|
||||||
text_padding="$((width / font_width + gap + xoffset/font_width))"
|
text_padding="$((width / font_width + gap + xoffset/font_width))"
|
||||||
}
|
}
|
||||||
|
|
||||||
make_thumbnail() {
|
make_thumbnail() {
|
||||||
# Name the thumbnail using variables so we can
|
# Name the thumbnail using variables so we can use it later.
|
||||||
# use it later.
|
image_name="$image_size-$crop_offset-$width-$height-${image##*/}"
|
||||||
image_name="$crop_mode-$crop_offset-$width-$height-${image##*/}"
|
|
||||||
|
|
||||||
# Handle file extensions.
|
# Handle file extensions.
|
||||||
case "${image##*.}" in
|
case "${image##*.}" in
|
||||||
@@ -2753,62 +2704,17 @@ make_thumbnail() {
|
|||||||
# Create the thumbnail dir if it doesn't exist.
|
# Create the thumbnail dir if it doesn't exist.
|
||||||
mkdir -p "$thumbnail_dir"
|
mkdir -p "$thumbnail_dir"
|
||||||
|
|
||||||
# Check to see if the thumbnail exists before we do any cropping.
|
[[ ! -f "$thumbnail_dir/$image_name" ]] && \
|
||||||
if [[ ! -f "$thumbnail_dir/$image_name" ]]; then
|
|
||||||
# Get image size so that we can do a better crop.
|
|
||||||
if [[ -z "$size" ]]; then
|
|
||||||
size="$(identify -format "%w %h" "$image")"
|
|
||||||
og_width="${size%% *}"
|
|
||||||
og_height="${size##* }"
|
|
||||||
|
|
||||||
# This checks to see if height is greater than width
|
|
||||||
# so we can do a better crop of portrait images.
|
|
||||||
size="$og_height"
|
|
||||||
((og_height > og_width)) && size="$og_width"
|
|
||||||
fi
|
|
||||||
|
|
||||||
case "$crop_mode" in
|
|
||||||
"fit")
|
|
||||||
c="$(convert "$image" \
|
|
||||||
-colorspace srgb \
|
|
||||||
-format "%[pixel:p{0,0}]" info:)"
|
|
||||||
|
|
||||||
convert \
|
convert \
|
||||||
-background none \
|
|
||||||
"$image" \
|
"$image" \
|
||||||
-trim +repage \
|
-strip \
|
||||||
-gravity south \
|
-quality 50 \
|
||||||
-background "$c" \
|
-gravity "$crop_offset" \
|
||||||
-extent "$size"x"$size" \
|
|
||||||
-scale "$width"x"$height" \
|
|
||||||
"$thumbnail_dir/$image_name"
|
|
||||||
;;
|
|
||||||
|
|
||||||
"fill")
|
|
||||||
convert \
|
|
||||||
-background none \
|
-background none \
|
||||||
"$image" \
|
-sample "$width"x"$height"^ \
|
||||||
-trim +repage \
|
|
||||||
-scale "$width"x"$height"^ \
|
|
||||||
-extent "$width"x"$height" \
|
-extent "$width"x"$height" \
|
||||||
"$thumbnail_dir/$image_name"
|
"$thumbnail_dir/$image_name"
|
||||||
;;
|
|
||||||
|
|
||||||
"none") cp "$image" "$thumbnail_dir/$image_name" ;;
|
|
||||||
*)
|
|
||||||
convert \
|
|
||||||
-background none \
|
|
||||||
"$image" \
|
|
||||||
-gravity "$crop_offset" \
|
|
||||||
-crop "$size"x"$size"+0+0 \
|
|
||||||
-quality 95 \
|
|
||||||
-scale "$width"x"$height" \
|
|
||||||
"$thumbnail_dir/$image_name"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
# The final image.
|
|
||||||
image="$thumbnail_dir/$image_name"
|
image="$thumbnail_dir/$image_name"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2831,16 +2737,8 @@ display_image() {
|
|||||||
to_off "Image: jp2a failed to display the image."
|
to_off "Image: jp2a failed to display the image."
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"pixterm")
|
|
||||||
pixterm -tc "$((width / font_width))" \
|
|
||||||
-tr "$((height / font_height))" \
|
|
||||||
"$image" ||\
|
|
||||||
to_off "Image: pixterm failed to display the image."
|
|
||||||
;;
|
|
||||||
|
|
||||||
"sixel")
|
"sixel")
|
||||||
img2sixel -w "$width" "$image" ||\
|
img2sixel -w "$width" "$image" || to_off "Image: libsixel failed to display the image."
|
||||||
to_off "Image: libsixel failed to display the image."
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"termpix")
|
"termpix")
|
||||||
@@ -4469,7 +4367,6 @@ IMAGE BACKEND:
|
|||||||
--catimg source Shortcut to use 'catimg' backend.
|
--catimg source Shortcut to use 'catimg' backend.
|
||||||
--iterm2 source Shortcut to use 'iterm2' backend.
|
--iterm2 source Shortcut to use 'iterm2' backend.
|
||||||
--jp2a source Shortcut to use 'jp2a' backend.
|
--jp2a source Shortcut to use 'jp2a' backend.
|
||||||
--pixterm source Shortcut to use 'pixterm' backend.
|
|
||||||
--sixel source Shortcut to use 'sixel' backend.
|
--sixel source Shortcut to use 'sixel' backend.
|
||||||
--termpix source Shortcut to use 'termpix' backend.
|
--termpix source Shortcut to use 'termpix' backend.
|
||||||
--tycat source Shortcut to use 'tycat' backend.
|
--tycat source Shortcut to use 'tycat' backend.
|
||||||
@@ -4505,11 +4402,9 @@ ASCII:
|
|||||||
IMAGE:
|
IMAGE:
|
||||||
--loop Redraw the image constantly until Ctrl+C is used. This fixes issues
|
--loop Redraw the image constantly until Ctrl+C is used. This fixes issues
|
||||||
in some terminals emulators when using image mode.
|
in some terminals emulators when using image mode.
|
||||||
--size 00px | --size 00% How to size the image.
|
--size auto | --size square How to size the image.
|
||||||
Possible values: auto, 00px, 00%, none
|
Possible values: auto, 00px, 00%, none
|
||||||
--crop_mode mode Which crop mode to use
|
--crop_offset value Change the crop offset for square mode.
|
||||||
Takes the values: normal, fit, fill
|
|
||||||
--crop_offset value Change the crop offset for normal mode.
|
|
||||||
Possible values: northwest, north, northeast,
|
Possible values: northwest, north, northeast,
|
||||||
west, center, east, southwest, south, southeast
|
west, center, east, southwest, south, southeast
|
||||||
|
|
||||||
@@ -4685,8 +4580,8 @@ get_args() {
|
|||||||
# Image backend
|
# Image backend
|
||||||
"--backend") image_backend="$2" ;;
|
"--backend") image_backend="$2" ;;
|
||||||
"--source") image_source="$2" ;;
|
"--source") image_source="$2" ;;
|
||||||
"--ascii" | "--caca" | "--catimg" | "--jp2a" | "--iterm2" | "--off" | "--pixterm" |\
|
"--ascii" | "--caca" | "--catimg" | "--jp2a" | "--iterm2" | "--off" | "--sixel" |\
|
||||||
"--sixel" | "--termpix" | "--tycat" | "--w3m")
|
"--termpix" | "--tycat" | "--w3m")
|
||||||
image_backend="${1/--}"
|
image_backend="${1/--}"
|
||||||
case "$2" in
|
case "$2" in
|
||||||
"-"* | "") ;;
|
"-"* | "") ;;
|
||||||
|
12
neofetch.1
12
neofetch.1
@@ -207,9 +207,6 @@ Shortcut to use 'iterm2' backend.
|
|||||||
\fB\-\-jp2a\fR source
|
\fB\-\-jp2a\fR source
|
||||||
Shortcut to use 'jp2a' backend.
|
Shortcut to use 'jp2a' backend.
|
||||||
.TP
|
.TP
|
||||||
\fB\-\-pixterm\fR source
|
|
||||||
Shortcut to use 'pixterm' backend.
|
|
||||||
.TP
|
|
||||||
\fB\-\-sixel\fR source
|
\fB\-\-sixel\fR source
|
||||||
Shortcut to use 'sixel' backend.
|
Shortcut to use 'sixel' backend.
|
||||||
.TP
|
.TP
|
||||||
@@ -262,16 +259,11 @@ Possible values: bar, infobar, barinfo, off
|
|||||||
Redraw the image constantly until Ctrl+C is used. This fixes issues
|
Redraw the image constantly until Ctrl+C is used. This fixes issues
|
||||||
in some terminals emulators when using image mode.
|
in some terminals emulators when using image mode.
|
||||||
.TP
|
.TP
|
||||||
\fB\-\-size\fR 00px | \fB\-\-size\fR 00%
|
\fB\-\-size\fR auto | \fB\-\-size\fR square How to size the image.
|
||||||
How to size the image.
|
|
||||||
Possible values: auto, 00px, 00%, none
|
Possible values: auto, 00px, 00%, none
|
||||||
.TP
|
.TP
|
||||||
\fB\-\-crop_mode\fR mode
|
|
||||||
Which crop mode to use
|
|
||||||
Takes the values: normal, fit, fill
|
|
||||||
.TP
|
|
||||||
\fB\-\-crop_offset\fR value
|
\fB\-\-crop_offset\fR value
|
||||||
Change the crop offset for normal mode.
|
Change the crop offset for square mode.
|
||||||
Possible values: northwest, north, northeast,
|
Possible values: northwest, north, northeast,
|
||||||
west, center, east, southwest, south, southeast
|
west, center, east, southwest, south, southeast
|
||||||
.TP
|
.TP
|
||||||
|
Reference in New Issue
Block a user