Merge branch 'master' of https://github.com/dylanaraps/neofetch into master

Merge all changes to master to this fork.
This commit is contained in:
Syphist 2020-10-13 14:30:29 -05:00
commit d2ea94a15d
2 changed files with 452 additions and 166 deletions

531
neofetch
View file

@ -75,7 +75,6 @@ print_info() {
info "Memory" memory info "Memory" memory
# info "GPU Driver" gpu_driver # Linux/macOS only # info "GPU Driver" gpu_driver # Linux/macOS only
# info "CPU Usage" cpu_usage
# info "Disk" disk # info "Disk" disk
# info "Battery" battery # info "Battery" battery
# info "Font" font # info "Font" font
@ -408,6 +407,13 @@ public_ip_host="http://ident.me"
# Flag: --ip_timeout # Flag: --ip_timeout
public_ip_timeout=2 public_ip_timeout=2
# Local IP interface
#
# Default: 'auto' (interface of default route)
# Values: 'auto', 'en0', 'en1'
# Flag: --ip_interface
local_ip_interface=('auto')
# Desktop Environment # Desktop Environment
@ -508,6 +514,7 @@ disk_percent="on"
# iTunes # iTunes
# juk # juk
# lollypop # lollypop
# MellowPlayer
# mocp # mocp
# mopidy # mopidy
# mpd # mpd
@ -721,8 +728,7 @@ bar_color_total="distro"
# #
# Default: 'off' # Default: 'off'
# Values: 'bar', 'infobar', 'barinfo', 'off' # Values: 'bar', 'infobar', 'barinfo', 'off'
# Flags: --cpu_display # Flags: --memory_display
# --memory_display
# --battery_display # --battery_display
# --disk_display # --disk_display
# #
@ -731,7 +737,6 @@ bar_color_total="distro"
# infobar: 'info [---=======]' # infobar: 'info [---=======]'
# barinfo: '[---=======] info' # barinfo: '[---=======] info'
# off: 'info' # off: 'info'
cpu_display="off"
memory_display="off" memory_display="off"
battery_display="off" battery_display="off"
disk_display="off" disk_display="off"
@ -743,8 +748,9 @@ disk_display="off"
# Image backend. # Image backend.
# #
# Default: 'ascii' # Default: 'ascii'
# Values: 'ascii', 'caca', 'chafa', 'jp2a', 'iterm2', 'off', # Values: 'ascii', 'caca', 'catimg', 'chafa', 'jp2a', 'iterm2', 'off',
# 'pot', 'termpix', 'pixterm', 'tycat', 'w3m', 'kitty' # 'pot', 'termpix', 'pixterm', 'tycat', 'w3m', 'kitty', 'ueberzug'
# Flag: --backend # Flag: --backend
image_backend="ascii" image_backend="ascii"
@ -880,6 +886,14 @@ crop_offset="center"
# --size # --size
image_size="auto" image_size="auto"
# Catimg block size.
# Control the resolution of catimg.
#
# Default: '2'
# Values: '1', '2'
# Flags: --catimg_size
catimg_size="2"
# Gap between image and text # Gap between image and text
# #
# Default: '3' # Default: '3'
@ -967,6 +981,10 @@ get_distro() {
*) distro="Red Star OS $(awk -F'[^0-9*]' '$0=$2' /etc/redstar-release)" *) distro="Red Star OS $(awk -F'[^0-9*]' '$0=$2' /etc/redstar-release)"
esac esac
elif [[ -f /etc/armbian-release ]]; then
. /etc/armbian-release
distro="Armbian $DISTRIBUTION_CODENAME (${VERSION:-})"
elif [[ -f /etc/siduction-version ]]; then elif [[ -f /etc/siduction-version ]]; then
case $distro_shorthand in case $distro_shorthand in
on|tiny) distro=Siduction ;; on|tiny) distro=Siduction ;;
@ -1432,7 +1450,7 @@ get_uptime() {
d="$((s / 60 / 60 / 24)) days" d="$((s / 60 / 60 / 24)) days"
h="$((s / 60 / 60 % 24)) hours" h="$((s / 60 / 60 % 24)) hours"
m="$((s / 60 % 60)) mins" m="$((s / 60 % 60)) minutes"
# Remove plural if < 2. # Remove plural if < 2.
((${d/ *} == 1)) && d=${d/s} ((${d/ *} == 1)) && d=${d/s}
@ -1446,41 +1464,52 @@ get_uptime() {
uptime=${d:+$d, }${h:+$h, }$m uptime=${d:+$d, }${h:+$h, }$m
uptime=${uptime%', '} uptime=${uptime%', '}
uptime=${uptime:-$s secs} uptime=${uptime:-$s seconds}
# Make the output of uptime smaller. # Make the output of uptime smaller.
case $uptime_shorthand in case $uptime_shorthand in
on) ;; on)
uptime=${uptime/ minutes/ mins}
uptime=${uptime/ minute/ min}
uptime=${uptime/ seconds/ secs}
;;
tiny) tiny)
uptime=${uptime/ days/d} uptime=${uptime/ days/d}
uptime=${uptime/ day/d} uptime=${uptime/ day/d}
uptime=${uptime/ hours/h} uptime=${uptime/ hours/h}
uptime=${uptime/ hour/h} uptime=${uptime/ hour/h}
uptime=${uptime/ mins/m} uptime=${uptime/ minutes/m}
uptime=${uptime/ min/m} uptime=${uptime/ minute/m}
uptime=${uptime/ secs/s} uptime=${uptime/ seconds/s}
uptime=${uptime//,} uptime=${uptime//,}
;; ;;
esac esac
} }
get_packages() { get_packages() {
# to adjust the number of pkgs per pkg manager
pkgs_h=0
# has: Check if package manager installed. # has: Check if package manager installed.
# dir: Count files or dirs in a glob. # dir: Count files or dirs in a glob.
# pac: If packages > 0, log package manager name. # pac: If packages > 0, log package manager name.
# tot: Count lines in command output. # tot: Count lines in command output.
has() { type -p "$1" >/dev/null && manager=$1; } has() { type -p "$1" >/dev/null && manager=$1; }
dir() { ((packages+=$#)); pac "$#"; } dir() { ((packages+=$#)); pac "$(($#-pkgs_h))"; }
pac() { (($1 > 0)) && { managers+=("$1 (${manager})"); manager_string+="${manager}, "; }; } pac() { (($1 > 0)) && { managers+=("$1 (${manager})"); manager_string+="${manager}, "; }; }
tot() { IFS=$'\n' read -d "" -ra pkgs <<< "$("$@")";((packages+=${#pkgs[@]}));pac "${#pkgs[@]}";} tot() {
IFS=$'\n' read -d "" -ra pkgs <<< "$("$@")";
((packages+=${#pkgs[@]}));
pac "$((${#pkgs[@]}-pkgs_h))";
}
# Redefine tot() for Bedrock Linux. # Redefine tot() for Bedrock Linux.
[[ -f /bedrock/etc/bedrock-release && $PATH == */bedrock/cross/* ]] && { [[ -f /bedrock/etc/bedrock-release && $PATH == */bedrock/cross/* ]] && {
tot() { tot() {
IFS=$'\n' read -d "" -ra pkgs <<< "$(for s in $(brl list); do strat -r "$s" "$@"; done)" IFS=$'\n' read -d "" -ra pkgs <<< "$(for s in $(brl list); do strat -r "$s" "$@"; done)"
((packages+="${#pkgs[@]}")) ((packages+="${#pkgs[@]}"))
pac "${#pkgs[@]}" pac "$((${#pkgs[@]}-pkgs_h))";
} }
br_prefix="/bedrock/strata/*" br_prefix="/bedrock/strata/*"
} }
@ -1489,6 +1518,7 @@ get_packages() {
Linux|BSD|"iPhone OS"|Solaris) Linux|BSD|"iPhone OS"|Solaris)
# Package Manager Programs. # Package Manager Programs.
has kiss && tot kiss l has kiss && tot kiss l
has cpt-list && tot cpt-list
has pacman-key && tot pacman -Qq --color never has pacman-key && tot pacman -Qq --color never
has dpkg && tot dpkg-query -f '.\n' -W has dpkg && tot dpkg-query -f '.\n' -W
has rpm && tot rpm -qa has rpm && tot rpm -qa
@ -1499,7 +1529,7 @@ get_packages() {
has lvu && tot lvu installed has lvu && tot lvu installed
has tce-status && tot tce-status -i has tce-status && tot tce-status -i
has pkg_info && tot pkg_info has pkg_info && tot pkg_info
has tazpkg && tot tazpkg list && ((packages-=6)) has tazpkg && pkgs_h=6 tot tazpkg list && ((packages-=6))
has sorcery && tot gaze installed has sorcery && tot gaze installed
has alps && tot alps showinstalled has alps && tot alps showinstalled
has butch && tot butch list has butch && tot butch list
@ -1560,7 +1590,8 @@ get_packages() {
# Snap hangs if the command is run without the daemon running. # Snap hangs if the command is run without the daemon running.
# Only run snap if the daemon is also running. # Only run snap if the daemon is also running.
has snap && ps -e | grep -qFm 1 snapd >/dev/null && tot snap list && ((packages-=1)) has snap && ps -e | grep -qFm 1 snapd >/dev/null && \
pkgs_h=1 tot snap list && ((packages-=1))
# This is the only standard location for appimages. # This is the only standard location for appimages.
# See: https://github.com/AppImage/AppImageKit/wiki # See: https://github.com/AppImage/AppImageKit/wiki
@ -1568,7 +1599,7 @@ get_packages() {
;; ;;
"Mac OS X"|"macOS"|MINIX) "Mac OS X"|"macOS"|MINIX)
has port && tot port installed && ((packages-=1)) has port && pkgs_h=1 tot port installed && ((packages-=1))
has brew && dir /usr/local/Cellar/* has brew && dir /usr/local/Cellar/*
has pkgin && tot pkgin list has pkgin && tot pkgin list
@ -1590,7 +1621,7 @@ get_packages() {
esac esac
# Scoop environment throws errors if `tot scoop list` is used # Scoop environment throws errors if `tot scoop list` is used
has scoop && dir ~/scoop/apps/* && ((packages-=1)) has scoop && pkgs_h=1 dir ~/scoop/apps/* && ((packages-=1))
# Count chocolatey packages. # Count chocolatey packages.
[[ -d /cygdrive/c/ProgramData/chocolatey/lib ]] && \ [[ -d /cygdrive/c/ProgramData/chocolatey/lib ]] && \
@ -1604,7 +1635,7 @@ get_packages() {
IRIX) IRIX)
manager=swpkg manager=swpkg
tot versions -b && ((packages-=3)) pkgs_h=3 tot versions -b && ((packages-=3))
;; ;;
esac esac
@ -1687,8 +1718,17 @@ get_de() {
Windows) Windows)
case $distro in case $distro in
"Windows 8"*|"Windows 10"*) de="Modern UI/Metro" ;; *"Windows 10"*)
*) de=Aero de=Fluent
;;
*"Windows 8"*)
de=Metro
;;
*)
de=Aero
;;
esac esac
;; ;;
@ -1778,9 +1818,15 @@ get_de() {
de_ver=${de_ver/* } de_ver=${de_ver/* }
de_ver=${de_ver//\"} de_ver=${de_ver//\"}
de="$de $de_ver" de+=" $de_ver"
fi fi
# TODO:
# - New config option + flag: --de_display_server on/off ?
# - Add display of X11, Arcan and anything else relevant.
[[ $de && $WAYLAND_DISPLAY ]] &&
de+=" (Wayland)"
de_run=1 de_run=1
} }
@ -1793,7 +1839,14 @@ get_wm() {
*) ps_flags=(-e) ;; *) ps_flags=(-e) ;;
esac esac
if [[ $WAYLAND_DISPLAY ]]; then if [[ -O "${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY:-wayland-0}" ]]; then
if tmp_pid="$(lsof -t "${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY:-wayland-0}" 2>&1)" ||
tmp_pid="$(fuser "${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY:-wayland-0}" 2>&1)"; then
wm="$(ps -p "${tmp_pid}" -ho comm=)"
else
# lsof may not exist, or may need root on some systems. Similarly fuser.
# On those systems we search for a list of known window managers, this can mistakenly
# match processes for another user or session and will miss unlisted window managers.
wm=$(ps "${ps_flags[@]}" | grep -m 1 -o -F \ wm=$(ps "${ps_flags[@]}" | grep -m 1 -o -F \
-e arcan \ -e arcan \
-e asc \ -e asc \
@ -1822,19 +1875,10 @@ get_wm() {
-e westeros \ -e westeros \
-e westford \ -e westford \
-e weston) -e weston)
fi
elif [[ $DISPLAY && $os != "Mac OS X" && $os != "macOS" && $os != FreeMiNT ]]; then elif [[ $DISPLAY && $os != "Mac OS X" && $os != "macOS" && $os != FreeMiNT ]]; then
type -p xprop &>/dev/null && { # non-EWMH WMs.
id=$(xprop -root -notype _NET_SUPPORTING_WM_CHECK)
id=${id##* }
wm=$(xprop -id "$id" -notype -len 100 -f _NET_WM_NAME 8t)
wm=${wm/*WM_NAME = }
wm=${wm/\"}
wm=${wm/\"*}
}
# Fallback for non-EWMH WMs.
[[ $wm ]] ||
wm=$(ps "${ps_flags[@]}" | grep -m 1 -o \ wm=$(ps "${ps_flags[@]}" | grep -m 1 -o \
-e "[s]owm" \ -e "[s]owm" \
-e "[c]atwm" \ -e "[c]atwm" \
@ -1846,6 +1890,15 @@ get_wm() {
-e "[x]11fs" \ -e "[x]11fs" \
-e "[x]monad") -e "[x]monad")
[[ -z $wm ]] && type -p xprop &>/dev/null && {
id=$(xprop -root -notype _NET_SUPPORTING_WM_CHECK)
id=${id##* }
wm=$(xprop -id "$id" -notype -len 100 -f _NET_WM_NAME 8t)
wm=${wm/*WM_NAME = }
wm=${wm/\"}
wm=${wm/\"*}
}
else else
case $os in case $os in
"Mac OS X"|"macOS") "Mac OS X"|"macOS")
@ -1869,15 +1922,21 @@ get_wm() {
;; ;;
Windows) Windows)
wm=$(tasklist | grep -m 1 -o -F \ wm=$(
tasklist |
grep -Fom 1 \
-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=${wm:+$wm, }Explorer wm="bbLean (Blackbox)"
wm=${wm:+$wm, }DWM.exe
;; ;;
FreeMiNT) FreeMiNT)
@ -2097,7 +2156,7 @@ get_cpu() {
# Select the right temperature file. # Select the right temperature file.
for temp_dir in /sys/class/hwmon/*; do for temp_dir in /sys/class/hwmon/*; do
[[ "$(< "${temp_dir}/name")" =~ (coretemp|fam15h_power|k10temp) ]] && { [[ "$(< "${temp_dir}/name")" =~ (cpu_thermal|coretemp|fam15h_power|k10temp) ]] && {
temp_dirs=("$temp_dir"/temp*_input) temp_dirs=("$temp_dir"/temp*_input)
temp_dir=${temp_dirs[0]} temp_dir=${temp_dirs[0]}
break break
@ -2196,8 +2255,7 @@ get_cpu() {
;; ;;
"OpenBSD"* | "Bitrig"*) "OpenBSD"* | "Bitrig"*)
deg="$(sysctl hw.sensors | \ deg="$(sysctl hw.sensors | \
awk -F '=| degC' '/lm0.temp|cpu0.temp/ {print $2; exit}')" awk -F'=|degC' '/(ksmn|adt|lm|cpu)0.temp0/ {printf("%2.1f", $2); exit}')"
deg="${deg/00/0}"
;; ;;
esac esac
;; ;;
@ -2336,47 +2394,6 @@ get_cpu() {
fi fi
} }
get_cpu_usage() {
case $os in
"Windows")
cpu_usage="$(wmic cpu get loadpercentage)"
cpu_usage="${cpu_usage/LoadPercentage}"
cpu_usage="${cpu_usage//[[:space:]]}"
;;
*)
# Get CPU cores if unset.
if [[ "$cpu_cores" != "logical" ]]; then
case $os in
"Linux" | "MINIX") cores="$(grep -c "^processor" /proc/cpuinfo)" ;;
"Mac OS X"|"macOS") cores="$(sysctl -n hw.logicalcpu_max)" ;;
"BSD") cores="$(sysctl -n hw.ncpu)" ;;
"Solaris") cores="$(kstat -m cpu_info | grep -c -F "chip_id")" ;;
"Haiku") cores="$(sysinfo -cpu | grep -c -F 'CPU #')" ;;
"iPhone OS") cores="${cpu/*\(}"; cores="${cores/\)*}" ;;
"IRIX") cores="$(sysconf NPROC_ONLN)" ;;
"FreeMiNT") cores="$(sysctl -n hw.ncpu)" ;;
"AIX")
cores="$(lparstat -i | awk -F':' '/Online Virtual CPUs/ {printf $2}')"
;;
esac
fi
cpu_usage="$(ps aux | awk 'BEGIN {sum=0} {sum+=$3}; END {print sum}')"
cpu_usage="$((${cpu_usage/\.*} / ${cores:-1}))"
;;
esac
# Print the bar.
case $cpu_display in
"bar") cpu_usage="$(bar "$cpu_usage" 100)" ;;
"infobar") cpu_usage="${cpu_usage}% $(bar "$cpu_usage" 100)" ;;
"barinfo") cpu_usage="$(bar "$cpu_usage" 100)${info_color} ${cpu_usage}%" ;;
*) cpu_usage="${cpu_usage}%" ;;
esac
}
get_gpu() { get_gpu() {
case $os in case $os in
"Linux") "Linux")
@ -2500,10 +2517,15 @@ get_gpu() {
"Windows") "Windows")
while read -r line; do while read -r line; do
prin "${subtitle:+${subtitle}${gpu_name}}" "$(trim "$line")" line=$(trim "$line")
done < <(wmic path Win32_VideoController get caption)
gpu=${gpu//Caption} [[ -z $win_gpu ]] || [[ -z "$line" ]] && {
win_gpu=1
continue
}
prin "${subtitle:+${subtitle}${gpu_name}}" "$line"
done < <(wmic path Win32_VideoController get caption)
;; ;;
"Haiku") "Haiku")
@ -2520,7 +2542,7 @@ get_gpu() {
;; ;;
*) *)
gpu="$(glxinfo | grep -F 'OpenGL renderer string')" gpu="$(glxinfo -B | grep -F 'OpenGL renderer string')"
gpu="${gpu/OpenGL renderer string: }" gpu="${gpu/OpenGL renderer string: }"
;; ;;
esac esac
@ -2695,6 +2717,7 @@ get_song() {
"iTunes" "iTunes"
"juk" "juk"
"lollypop" "lollypop"
"MellowPlayer"
"mocp" "mocp"
"mopidy" "mopidy"
"mpd" "mpd"
@ -2771,6 +2794,7 @@ get_song() {
"netease-cloud-music"*) get_song_dbus "netease-cloud-music" ;; "netease-cloud-music"*) get_song_dbus "netease-cloud-music" ;;
"plasma-browser-integration"*) get_song_dbus "plasma-browser-integration" ;; "plasma-browser-integration"*) get_song_dbus "plasma-browser-integration" ;;
"io.elementary.music"*) get_song_dbus "Music" ;; "io.elementary.music"*) get_song_dbus "Music" ;;
"MellowPlayer"*) get_song_dbus "MellowPlayer3" ;;
"mpd"* | "mopidy"*) "mpd"* | "mopidy"*)
song="$(mpc -f '%artist% \n%album% \n%title%' current "${mpc_args[@]}")" song="$(mpc -f '%artist% \n%album% \n%title%' current "${mpc_args[@]}")"
@ -3406,15 +3430,16 @@ END
# like a font definition. NOTE: There is a slight limitation in this approach. # like a font definition. NOTE: There is a slight limitation in this approach.
# Technically "Font Name" is a valid font. As it doesn't specify any font options # Technically "Font Name" is a valid font. As it doesn't specify any font options
# though it is hard to match it correctly amongst the rest of the noise. # though it is hard to match it correctly amongst the rest of the noise.
[[ -n "$binary" ]] && \ [[ -n "$binary" ]] &&
term_font="$(strings "$binary" | grep -F -m 1 \ term_font=$(
-e "pixelsize=" \ strings "$binary" |
-e "size=" \
-e "antialias=" \ grep -m 1 "*font[^2]"
-e "autohint=")" )
fi fi
term_font="${term_font/xft:}" term_font="${term_font/xft:}"
term_font="${term_font#*=}"
term_font="${term_font/:*}" term_font="${term_font/:*}"
;; ;;
@ -3666,6 +3691,9 @@ get_battery() {
battery="$(wmic Path Win32_Battery get EstimatedChargeRemaining)" battery="$(wmic Path Win32_Battery get EstimatedChargeRemaining)"
battery="${battery/EstimatedChargeRemaining}" battery="${battery/EstimatedChargeRemaining}"
battery="$(trim "$battery")%" battery="$(trim "$battery")%"
state="$(wmic /NameSpace:'\\root\WMI' Path BatteryStatus get Charging)"
state="${state/Charging}"
[[ "$state" == *TRUE* ]] && battery_state="charging"
;; ;;
"Haiku") "Haiku")
@ -3687,9 +3715,25 @@ get_battery() {
get_local_ip() { get_local_ip() {
case $os in case $os in
"Linux" | "BSD" | "Solaris" | "AIX" | "IRIX") "Linux" | "BSD" | "Solaris" | "AIX" | "IRIX")
if [[ "${local_ip_interface[0]}" == "auto" ]]; then
local_ip="$(ip route get 1 | awk -F'src' '{print $2; exit}')" local_ip="$(ip route get 1 | awk -F'src' '{print $2; exit}')"
local_ip="${local_ip/uid*}" local_ip="${local_ip/uid*}"
[[ -z "$local_ip" ]] && local_ip="$(ifconfig -a | awk '/broadcast/ {print $2; exit}')" [[ "$local_ip" ]] || local_ip="$(ifconfig -a | awk '/broadcast/ {print $2; exit}')"
else
for interface in "${local_ip_interface[@]}"; do
local_ip="$(ip addr show "$interface" 2> /dev/null |
awk '/inet / {print $2; exit}')"
local_ip="${local_ip/\/*}"
[[ "$local_ip" ]] ||
local_ip="$(ifconfig "$interface" 2> /dev/null |
awk '/broadcast/ {print $2; exit}')"
if [[ -n "$local_ip" ]]; then
prin "$interface" "$local_ip"
else
err "Local IP: Could not detect local ip for $interface"
fi
done
fi
;; ;;
"MINIX") "MINIX")
@ -3697,8 +3741,19 @@ get_local_ip() {
;; ;;
"Mac OS X" | "macOS" | "iPhone OS") "Mac OS X" | "macOS" | "iPhone OS")
local_ip="$(ipconfig getifaddr en0)" if [[ "${local_ip_interface[0]}" == "auto" ]]; then
[[ -z "$local_ip" ]] && local_ip="$(ipconfig getifaddr en1)" interface="$(route get 1 | awk -F': ' '/interface/ {printf $2; exit}')"
local_ip="$(ipconfig getifaddr "$interface")"
else
for interface in "${local_ip_interface[@]}"; do
local_ip="$(ipconfig getifaddr "$interface")"
if [[ -n "$local_ip" ]]; then
prin "$interface" "$local_ip"
else
err "Local IP: Could not detect local ip for $interface"
fi
done
fi
;; ;;
"Windows") "Windows")
@ -3801,11 +3856,11 @@ get_cols() {
[${text_padding}C${zws}} [${text_padding}C${zws}}
# Add block height to info height. # Add block height to info height.
((info_height+=block_range[1]>7?block_height+3:block_height+2)) ((info_height+=block_range[1]>7?block_height+2:block_height+1))
case $col_offset in case $col_offset in
"auto") printf '\n\e[%bC%b\n\n' "$text_padding" "${zws}${cols}" ;; "auto") printf '\n\e[%bC%b\n' "$text_padding" "${zws}${cols}" ;;
*) printf '\n\e[%bC%b\n\n' "$col_offset" "${zws}${cols}" ;; *) printf '\n\e[%bC%b\n' "$col_offset" "${zws}${cols}" ;;
esac esac
fi fi
@ -3825,14 +3880,15 @@ image_backend() {
"ascii") print_ascii ;; "ascii") print_ascii ;;
"off") image_backend="off" ;; "off") image_backend="off" ;;
"caca" | "chafa" | "jp2a" | "iterm2" | "termpix" |\ "caca" | "catimg" | "chafa" | "jp2a" | "iterm2" | "termpix" |\
"tycat" | "w3m" | "sixel" | "pixterm" | "kitty" | "pot") "tycat" | "w3m" | "sixel" | "pixterm" | "kitty" | "pot", | "ueberzug")
get_image_source get_image_source
[[ ! -f "$image" ]] && { [[ ! -f "$image" ]] && {
to_ascii "Image: '$image_source' doesn't exist, falling back to ascii mode." to_ascii "Image: '$image_source' doesn't exist, falling back to ascii mode."
return return
} }
[[ "$image_backend" == "ueberzug" ]] && wait=true;
get_window_size get_window_size
@ -3850,9 +3906,9 @@ 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', 'chafa', 'jp2a', 'iterm2', 'kitty', err "Image: Valid backends are: 'ascii', 'caca', 'catimg', 'chafa', 'jp2a', 'iterm2',
'off', 'sixel', 'pot', 'pixterm', 'termpix', 'tycat', 'kitty', 'off', 'sixel', 'pot', 'pixterm', 'termpix',
'w3m')" 'tycat', 'w3m')"
err "Image: Falling back to ascii mode." err "Image: Falling back to ascii mode."
print_ascii print_ascii
;; ;;
@ -3906,7 +3962,14 @@ print_ascii() {
done <<< "${ascii_data//\$\{??\}}" done <<< "${ascii_data//\$\{??\}}"
# Fallback if file not found. # Fallback if file not found.
((lines==1)) && { lines=; ascii_len=; image_source=auto; get_distro_ascii; print_ascii; return; } ((lines==1)) && {
lines=
ascii_len=
image_source=auto
get_distro_ascii
print_ascii
return
}
# Colors. # Colors.
ascii_data="${ascii_data//\$\{c1\}/$c1}" ascii_data="${ascii_data//\$\{c1\}/$c1}"
@ -4264,6 +4327,28 @@ display_image() {
"$image" "$image"
;; ;;
"ueberzug")
if [ "$wait" = true ];then
wait=false;
else
source "$(ueberzug library)"
ImageLayer 0< <(
ImageLayer::add\
['identifier']="neofetch"\
['x']="$xoffset" ['y']="$yoffset"\
['max_width']="$((width / font_width))"\
['max_height']="$((height / font_height))"\
['path']="$image";
read -rs;
)
fi
;;
"catimg")
catimg -w "$((width*catimg_size / font_width))" -r "$catimg_size" "$image"
;;
"chafa") "chafa")
chafa --stretch --size="$((width / font_width))x$((height / font_height))" "$image" chafa --stretch --size="$((width / font_width))x$((height / font_height))" "$image"
;; ;;
@ -4861,6 +4946,7 @@ INFO:
--ip_host url URL to query for public IP --ip_host url URL to query for public IP
--ip_timeout int Public IP timeout (in seconds). --ip_timeout int Public IP timeout (in seconds).
--ip_interface value Interface(s) to use for local IP
--song_format format Print the song data in a specific format (see config file). --song_format format Print the song data in a specific format (see config file).
--song_shorthand on/off Print the Artist/Album/Title on separate lines. --song_shorthand on/off Print the Artist/Album/Title on separate lines.
--memory_percent on/off Display memory percentage. --memory_percent on/off Display memory percentage.
@ -4890,8 +4976,6 @@ BARS:
--bar_length num Length in spaces to make the bars. --bar_length num Length in spaces to make the bars.
--bar_colors num num Colors to make the bar. --bar_colors num num Colors to make the bar.
Set in this order: elapsed, total Set in this order: elapsed, total
--cpu_display mode Bar mode.
Possible values: bar, infobar, barinfo, off
--memory_display mode Bar mode. --memory_display mode Bar mode.
Possible values: bar, infobar, barinfo, off Possible values: bar, infobar, barinfo, off
--battery_display mode Bar mode. --battery_display mode Bar mode.
@ -4901,8 +4985,8 @@ BARS:
IMAGE BACKEND: IMAGE BACKEND:
--backend backend Which image backend to use. --backend backend Which image backend to use.
Possible values: 'ascii', 'caca', 'chafa', 'jp2a', 'iterm2', Possible values: 'ascii', 'caca', 'catimg', 'chafa', 'jp2a',
'off', 'sixel', 'tycat', 'w3m', 'kitty' 'iterm2', 'off', 'sixel', 'tycat', 'w3m', 'kitty'
--source source Which image or ascii file to use. --source source Which image or ascii file to use.
Possible values: 'auto', 'ascii', 'wallpaper', '/path/to/img', Possible values: 'auto', 'ascii', 'wallpaper', '/path/to/img',
'/path/to/ascii', '/path/to/dir/', 'command output' [ascii] '/path/to/ascii', '/path/to/dir/', 'command output' [ascii]
@ -4912,6 +4996,7 @@ IMAGE BACKEND:
NEW: neofetch --ascii \"\$(fortune | cowsay -W 30)\" NEW: neofetch --ascii \"\$(fortune | cowsay -W 30)\"
--caca source Shortcut to use 'caca' backend. --caca source Shortcut to use 'caca' backend.
--catimg source Shortcut to use 'catimg' backend.
--chafa source Shortcut to use 'chafa' backend. --chafa source Shortcut to use 'chafa' 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.
@ -4922,6 +5007,7 @@ IMAGE 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.
--w3m source Shortcut to use 'w3m' backend. --w3m source Shortcut to use 'w3m' backend.
--ueberzug source Shortcut to use 'ueberzug' backend
--off Shortcut to use 'off' backend (Disable ascii art). --off Shortcut to use 'off' backend (Disable ascii art).
NOTE: 'source; can be any of the following: 'auto', 'ascii', 'wallpaper', '/path/to/img', NOTE: 'source; can be any of the following: 'auto', 'ascii', 'wallpaper', '/path/to/img',
@ -4985,6 +5071,7 @@ IMAGE:
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 00px | --size 00% How to size the image.
Possible values: auto, 00px, 00%, none Possible values: auto, 00px, 00%, none
--catimg_size 1/2 Change the resolution of catimg.
--crop_mode mode Which crop mode to use --crop_mode mode Which crop mode to use
Takes the values: normal, fit, fill Takes the values: normal, fit, fill
--crop_offset value Change the crop offset for normal mode. --crop_offset value Change the crop offset for normal mode.
@ -5054,6 +5141,17 @@ get_args() {
"--shell_version") shell_version="$2" ;; "--shell_version") shell_version="$2" ;;
"--ip_host") public_ip_host="$2" ;; "--ip_host") public_ip_host="$2" ;;
"--ip_timeout") public_ip_timeout="$2" ;; "--ip_timeout") public_ip_timeout="$2" ;;
"--ip_interface")
unset local_ip_interface
for arg in "$@"; do
case "$arg" in
"--ip_interface") ;;
"-"*) break ;;
*) local_ip_interface+=("$arg") ;;
esac
done
;;
"--song_format") song_format="$2" ;; "--song_format") song_format="$2" ;;
"--song_shorthand") song_shorthand="$2" ;; "--song_shorthand") song_shorthand="$2" ;;
"--music_player") music_player="$2" ;; "--music_player") music_player="$2" ;;
@ -5128,7 +5226,6 @@ get_args() {
bar_color_total="$3" bar_color_total="$3"
;; ;;
"--cpu_display") cpu_display="$2" ;;
"--memory_display") memory_display="$2" ;; "--memory_display") memory_display="$2" ;;
"--battery_display") battery_display="$2" ;; "--battery_display") battery_display="$2" ;;
"--disk_display") disk_display="$2" ;; "--disk_display") disk_display="$2" ;;
@ -5136,8 +5233,9 @@ get_args() {
# Image backend # Image backend
"--backend") image_backend="$2" ;; "--backend") image_backend="$2" ;;
"--source") image_source="$2" ;; "--source") image_source="$2" ;;
"--ascii" | "--caca" | "--chafa" | "--jp2a" | "--iterm2" | "--off" | "--pot" |\ "--ascii" | "--caca" | "--catimg" | "--chafa" | "--jp2a" | "--iterm2" | "--off" |\
"--pixterm" | "--sixel" | "--termpix" | "--tycat" | "--w3m" | "--kitty") "--pot" | "--pixterm" | "--sixel" | "--termpix" | "--tycat" | "--w3m" | "--kitty" |\
"--ueberzug")
image_backend="${1/--}" image_backend="${1/--}"
case $2 in case $2 in
"-"* | "") ;; "-"* | "") ;;
@ -5148,6 +5246,7 @@ get_args() {
# Image options # Image options
"--loop") image_loop="on" ;; "--loop") image_loop="on" ;;
"--image_size" | "--size") image_size="$2" ;; "--image_size" | "--size") image_size="$2" ;;
"--catimg_size") catimg_size="$2" ;;
"--crop_mode") crop_mode="$2" ;; "--crop_mode") crop_mode="$2" ;;
"--crop_offset") crop_offset="$2" ;; "--crop_offset") crop_offset="$2" ;;
"--xoffset") xoffset="$2" ;; "--xoffset") xoffset="$2" ;;
@ -5244,7 +5343,6 @@ get_args() {
info "GPU Driver" gpu_driver info "GPU Driver" gpu_driver
info "Memory" memory info "Memory" memory
info "CPU Usage" cpu_usage
info "Disk" disk info "Disk" disk
info "Battery" battery info "Battery" battery
info "Font" font info "Font" font
@ -5266,7 +5364,6 @@ get_args() {
refresh_rate="on" refresh_rate="on"
shell_version="on" shell_version="on"
cpu_display="infobar"
memory_display="infobar" memory_display="infobar"
disk_display="infobar" disk_display="infobar"
cpu_temp="C" cpu_temp="C"
@ -5297,6 +5394,7 @@ get_simple() {
old_functions() { old_functions() {
# Removed functions for backwards compatibility. # Removed functions for backwards compatibility.
get_line_break() { :; } get_line_break() { :; }
get_cpu_usage() { :; }
} }
get_distro_ascii() { get_distro_ascii() {
@ -5511,6 +5609,34 @@ ${c1} -o o-
EOF EOF
;; ;;
"instantOS"*)
set_colors 4 6
read -rd '' ascii_data <<'EOF'
${c1}
'cx0XWWMMWNKOd:'.
.;kNMMMMMMMMMMMMMWNKd'
'kNMMMMMMWNNNWMMMMMMMMXo.
,0MMMMMW0o;'..,:dKWMMMMMWx.
OMMMMMXl. .xNMMMMMNo
WMMMMNl .kWWMMMMO'
MMMMMX; oNWMMMMK,
NMMMMWo .OWMMMMMK,
kWMMMMNd. ,kWMMMMMMK,
'kWMMMMWXxl:;;:okNMMMMMMMMK,
.oXMMMMMMMWWWMMMMMMMMMMMMK,
'oKWMMMMMMMMMMMMMMMMMMMK,
.;lxOKXXXXXXXXXXXXXXXO;......
................,d0000000kd:.
.kMMMMMMMMMW0;
.kMMMMMMMMMMMX
.xMMMMMMMMMMMW
cXMMMMMMMMMM0
:0WMMMMMMNx,
.o0NMWNOc.
EOF
;;
"Antergos"*) "Antergos"*)
set_colors 4 6 set_colors 4 6
read -rd '' ascii_data <<'EOF' read -rd '' ascii_data <<'EOF'
@ -5629,6 +5755,30 @@ dhhyys+/-`
EOF EOF
;; ;;
"Archcraft"*)
set_colors 6 6 7 1
read -rd '' ascii_data <<'EOF'
${c1} -m:
:NMM+ .+
+MMMMMo -NMy
sMMMMMMMy -MMMMh`
yMMMMMMMMMd` oMMMMd`
`dMMMMMMMMMMMm. /MMMMm-
.mMMMMMm-dMMMMMN- :NMMMN:
-NMMMMMd` yMMMMMN: .mMMMM/
:NMMMMMy sMMMMMM+ `dMMMMo
+MMMMMMs +MMMMMMs `hMMMMy
oMMMMMMMds- :NMMMMMy sMMMMh`
yMMMMMNoydMMmo` -NMMMMMd` +MMMMd.
`dMMMMMN- `:yNNs` .mMMMMMm. /MMMMm-
.mMMMMMm. :hN/ `dMMMMMN- -NMMMN:
-NMMMMMd` -hh` `yMMMMMN: .mMMMM/
:NMMMMMy `s` :h. oMMMMMM+ `-----
+MMMMMMo .dMm. `o. +MMMMMMo
sMMMMMM+ .mMMMN: :` :NMMMMMy
EOF
;;
"arcolinux_small"*) "arcolinux_small"*)
set_colors 7 4 set_colors 7 4
read -rd '' ascii_data <<'EOF' read -rd '' ascii_data <<'EOF'
@ -7677,6 +7827,34 @@ EOF
\ LE \ / \ LE \ /
\ DE \ / \ DE \ /
\________\/ \________\/
EOF
;;
"LaxerOS"*)
set_colors 7 4
read -rd '' ascii_data <<'EOF'
${c2}
/.
`://:-
`//////:
.////////:`
-//////////:`
-/////////////`
:///////////////.
`://////.```-//////-
`://///:` .//////-
`//////: `//////:
.//////- `://///:`
-//////- `://///:`
-//////. ://////`
://////` -//////.
`/////:` ./////:
.-::-` .:::-`
.:://////////////////////////////////::.
////////////////////////////////////////
.:////////////////////////////////////:.
EOF EOF
;; ;;
@ -8128,6 +8306,31 @@ ${c2} ``-:::::-``
EOF EOF
;; ;;
"Live Raizo"* | "Live_Raizo"*)
set_colors 3
read -rd '' ascii_data <<'EOF'
${c1} `......`
-+shmNMMMMMMNmhs/.
:smMMMMMmmhyyhmmMMMMMmo-
-hMMMMd+:. `----` .:odMMMMh-
`hMMMN+. .odNMMMMMMNdo. .yMMMMs`
hMMMd. -dMMMMmdhhdNMMMNh` .mMMMh
oMMMm` :MMMNs.:sddy:-sMMMN- `NMMM+
mMMMs dMMMo sMMMMMMd yMMMd sMMMm
----` .---` oNMMMMMh `---. .----
.sMMy:
/MM/
+dMMms.
hMMMMMMN
`dMMMMMMm:
.+ss+sMNysMMoomMd+ss+.
+MMMMMMN` +MM/ hMMMMMNs
sMMMMMMm-hNMMMd-hMMMMMMd
:yddh+`hMMMMMMN :yddy/`
.hMMMMd:
`..`
EOF
;;
"mx_small"*) "mx_small"*)
set_colors 4 6 7 set_colors 4 6 7
@ -9105,6 +9308,30 @@ ${c1} `..--..`
EOF EOF
;; ;;
"Quibian"*)
set_colors 3 7
read -rd '' ascii_data <<'EOF'
${c1} `.--::::::::--.`
`.-:::-..`` ``..-::-.`
.::::-` .${c2}+${c1}:`` `.-::.`
.::::.` -::::::-` `.::.
`-:::-` -:::::::::--..`` .::`
`::::- .${c2}oy${c1}:::::::---.```.: `::`
-:::: `.-:::::::::::-.``` `::
.::::.`-:::::::::::::. `:.
-::::.::::::::::::::: -:
::::::::::::::::::::` `:
:::::::::::::::::::- `:
::::::::::::::::::: --
.:::::::::::::::::` `:`
`::::::::::::::::: -`
.:::::::::::::::- -`
`::::::::::::::- `.`
.::::::::::::- ``
`.--:::::-.
EOF
;;
"Radix"*) "Radix"*)
set_colors 1 2 set_colors 1 2
read -rd '' ascii_data <<'EOF' read -rd '' ascii_data <<'EOF'
@ -9132,16 +9359,15 @@ EOF
"Raspbian_small"*) "Raspbian_small"*)
set_colors 2 1 set_colors 2 1
read -rd '' ascii_data <<'EOF' read -rd '' ascii_data <<'EOF'
${c1} .~~. .~~. ${c1} .. ,.
'. \\ ' ' / .' :oo: .:oo:
${c2} .~ .~~~..~. 'o\\o o/o:
: .~.'~'.~. : ${c2} :: . :: . ::
~ ( ) ( ) ~ :: ::: ::: ::
( : '~'.~.'~' : ) :' '',.'' ':
~ .~ ( ) ~. ~ ::: :::: :::
( : '~' : ) ':, '' ,:'
'~ .~~~. ~' ' ~::~ '
'~'
EOF EOF
;; ;;
@ -10192,6 +10418,32 @@ oss${c2}yNMMMNyMMh${c1}sssssssssssssshmmmh${c1}ssssssso
EOF EOF
;; ;;
"Univention"*)
set_colors 1 7
read -rd '' ascii_data <<'EOF'
${c1} ./osssssssssssssssssssssso+-
`ohhhhhhhhhhhhhhhhhhhhhhhhhhhhy:
shhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh-
`-//${c2}sssss${c1}/hhhhhhhhhhhhhh+${c2}s${c1}.hhhhhhhhh+
.ohhhy${c2}sssss${c1}.hhhhhhhhhhhhhh.${c2}sss${c1}+hhhhhhh+
.yhhhhy${c2}sssss${c1}.hhhhhhhhhhhhhh.${c2}ssss${c1}:hhhhhh+
+hhhhhy${c2}sssss${c1}.hhhhhhhhhhhhhh.${c2}sssss${c1}yhhhhh+
+hhhhhy${c2}sssss${c1}.hhhhhhhhhhhhhh.${c2}sssss${c1}yhhhhh+
+hhhhhy${c2}sssss${c1}.hhhhhhhhhhhhhh.${c2}sssss${c1}yhhhhh+
+hhhhhy${c2}sssss${c1}.hhhhhhhhhhhhhh.${c2}sssss${c1}yhhhhh+
+hhhhhy${c2}sssss${c1}.hhhhhhhhhhhhhh.${c2}sssss${c1}yhhhhh+
+hhhhhy${c2}sssss${c1}.hhhhhhhhhhhhhh.${c2}sssss${c1}yhhhhh+
+hhhhhy${c2}sssss${c1}.hhhhhhhhhhhhhh.${c2}sssss${c1}yhhhhh+
+hhhhhy${c2}ssssss${c1}+yhhhhhhhhhhy/${c2}ssssss${c1}yhhhhh+
+hhhhhh:${c2}sssssss${c1}:hhhhhhh+${c2}.ssssssss${c1}yhhhhy.
+hhhhhhh+`${c2}ssssssssssssssss${c1}hh${c2}sssss${c1}yhhho`
+hhhhhhhhhs+${c2}ssssssssssss${c1}+hh+${c2}sssss${c1}/:-`
-hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhho
:yhhhhhhhhhhhhhhhhhhhhhhhhhhhh+`
-+ossssssssssssssssssssss+:`
EOF
;;
"Venom"*) "Venom"*)
set_colors 8 4 set_colors 8 4
read -rd '' ascii_data <<'EOF' read -rd '' ascii_data <<'EOF'
@ -10248,6 +10500,36 @@ ${c1} -1vvnvv. `~+++` ++|+++
~|Invnvnvvnvvvnnv}+` ~|Invnvnvvnvvvnnv}+`
-~|{*l}*|~ -~|{*l}*|~
EOF EOF
;;
"semc"*)
set_colors 2 8
read -rd '' ascii_data <<'EOF'
${c1} __.;=====;.__
_.=+==++=++=+=+===;.
-=+++=+===+=+=+++++=_
. -=:`` `--==+=++==.
_vi, ` --+=++++:
.uvnvi. _._ -==+==+.
.vvnvnI` .;==|==;. :|=||=|.
${c2} _______._______.___ ___. ______
/ | ____| \/ | / |
| (----| |__ | \ / || ,----'
\ \ | __| | |\/| || |
.----) | | |____| | | || `----.
|_______/ |_______|__| |__| \______|
${c1} -1vvnvv. `~+++` ++|+++
+vnvnnv, `-|===
+vnvnvns. . :=-
-Invnvvnsi..___..=sv=. `
+Invnvnvnnnnnnnnvvnn;.
~|Invnvnvvnvvvnnv}+`
-~|{*l}*|~
EOF
;; ;;
"Obarun"*) "Obarun"*)
@ -10596,6 +10878,7 @@ main() {
# w3m-img: Draw the image a second time to fix # w3m-img: Draw the image a second time to fix
# rendering issues in specific terminal emulators. # rendering issues in specific terminal emulators.
[[ $image_backend == *w3m* ]] && display_image [[ $image_backend == *w3m* ]] && display_image
[[ $image_backend == *ueberzug* ]] && display_image
# Add neofetch info to verbose output. # Add neofetch info to verbose output.
err "Neofetch command: $0 $*" err "Neofetch command: $0 $*"

View file

@ -235,7 +235,7 @@ Possible values: bar, infobar, barinfo, off
\fB\-\-backend\fR backend \fB\-\-backend\fR backend
Which image backend to use. Which image backend to use.
Possible values: 'ascii', 'caca', 'chafa', 'jp2a', 'iterm2', Possible values: 'ascii', 'caca', 'chafa', 'jp2a', 'iterm2',
\&'off', 'sixel', 'tycat', 'w3m', 'kitty' \&'off', 'sixel', 'tycat', 'w3m', 'kitty', 'ueberzug'
.TP .TP
\fB\-\-source\fR source \fB\-\-source\fR source
Which image or ascii file to use. Which image or ascii file to use.
@ -280,6 +280,9 @@ Shortcut to use 'tycat' backend.
\fB\-\-w3m\fR source \fB\-\-w3m\fR source
Shortcut to use 'w3m' backend. Shortcut to use 'w3m' backend.
.TP .TP
\fB\-\-ueberzug\fR source
Shortcut to use 'ueberzug' backend.
.TP
\fB\-\-off\fR \fB\-\-off\fR
Shortcut to use 'off' backend (Disable ascii art). Shortcut to use 'off' backend (Disable ascii art).
.IP .IP
@ -365,11 +368,11 @@ west, center, east, southwest, south, southeast
.TP .TP
\fB\-\-xoffset\fR px \fB\-\-xoffset\fR px
How close the image will be to the left edge of the How close the image will be to the left edge of the
window. This only works with w3m. window. This only works with w3m and ueberzug.
.TP .TP
\fB\-\-yoffset\fR px \fB\-\-yoffset\fR px
How close the image will be to the top edge of the How close the image will be to the top edge of the
window. This only works with w3m. window. This only works with w3m and ueberzug.
.TP .TP
\fB\-\-bg_color\fR color \fB\-\-bg_color\fR color
Background color to display behind transparent image. Background color to display behind transparent image.