From 5f8ce9bbc462c28f5976e14245e7df5a236e52fc Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Thu, 17 Sep 2020 08:27:48 +0300 Subject: [PATCH 01/32] packages: Add support for carbs --- neofetch | 1 + 1 file changed, 1 insertion(+) diff --git a/neofetch b/neofetch index 4a380962..0df70a8a 100755 --- a/neofetch +++ b/neofetch @@ -1489,6 +1489,7 @@ get_packages() { Linux|BSD|"iPhone OS"|Solaris) # Package Manager Programs. has kiss && tot kiss l + has cpt-list && tot cpt-list has pacman-key && tot pacman -Qq --color never has dpkg && tot dpkg-query -f '.\n' -W has rpm && tot rpm -qa From af4cf16bf4ec5c9ad4a93d71f715fdf14c88db6d Mon Sep 17 00:00:00 2001 From: ncmprhnsbl Date: Thu, 17 Sep 2020 21:58:37 +1000 Subject: [PATCH 02/32] add song= support for MellowPlayer using get_song_dbus (#1558) * add song= support for MellowPlayer using get_song_dbus * adjusted indent for mellowplayer get_song_dbus Co-authored-by: ncmprhnsb1 --- neofetch | 3 +++ 1 file changed, 3 insertions(+) diff --git a/neofetch b/neofetch index 0df70a8a..bce4e2a9 100755 --- a/neofetch +++ b/neofetch @@ -508,6 +508,7 @@ disk_percent="on" # iTunes # juk # lollypop +# MellowPlayer # mocp # mopidy # mpd @@ -2696,6 +2697,7 @@ get_song() { "iTunes" "juk" "lollypop" + "MellowPlayer" "mocp" "mopidy" "mpd" @@ -2772,6 +2774,7 @@ get_song() { "netease-cloud-music"*) get_song_dbus "netease-cloud-music" ;; "plasma-browser-integration"*) get_song_dbus "plasma-browser-integration" ;; "io.elementary.music"*) get_song_dbus "Music" ;; + "MellowPlayer"*) get_song_dbus "MellowPlayer3" ;; "mpd"* | "mopidy"*) song="$(mpc -f '%artist% \n%album% \n%title%' current "${mpc_args[@]}")" From 8a9eacbab8653bb5f4546d51e50af3b15518caaa Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Sat, 19 Sep 2020 23:47:15 +0200 Subject: [PATCH 03/32] os: Add Live Raizo (#1560) --- neofetch | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/neofetch b/neofetch index bce4e2a9..3c27b00e 100755 --- a/neofetch +++ b/neofetch @@ -8108,6 +8108,31 @@ ${c2} ``-:::::-`` 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"*) set_colors 4 6 7 From f74746d5b94727587fccd43820396335e0d928b0 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Sun, 20 Sep 2020 18:28:17 +0200 Subject: [PATCH 04/32] os: Add Quibian (#1561) --- neofetch | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/neofetch b/neofetch index 3c27b00e..e8de6b06 100755 --- a/neofetch +++ b/neofetch @@ -9110,6 +9110,30 @@ ${c1} `..--..` EOF ;; + "Quibian"*) + set_colors 3 7 + read -rd '' ascii_data <<'EOF' +${c1} `.--::::::::--.` + `.-:::-..`` ``..-::-.` + .::::-` .${c2}+${c1}:`` `.-::.` + .::::.` -::::::-` `.::. + `-:::-` -:::::::::--..`` .::` + `::::- .${c2}oy${c1}:::::::---.```.: `::` + -:::: `.-:::::::::::-.``` `:: +.::::.`-:::::::::::::. `:. +-::::.::::::::::::::: -: +::::::::::::::::::::` `: +:::::::::::::::::::- `: +::::::::::::::::::: -- +.:::::::::::::::::` `:` +`::::::::::::::::: -` + .:::::::::::::::- -` + `::::::::::::::- `.` + .::::::::::::- `` + `.--:::::-. +EOF + ;; + "Radix"*) set_colors 1 2 read -rd '' ascii_data <<'EOF' From b83a48a60f2a06b87b4d6532f3e2cc1df6d0795e Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 25 Sep 2020 13:36:46 +0200 Subject: [PATCH 05/32] uptime: Fix shorthand off (#1564) --- neofetch | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/neofetch b/neofetch index e8de6b06..c9a3e5cd 100755 --- a/neofetch +++ b/neofetch @@ -1433,7 +1433,7 @@ get_uptime() { d="$((s / 60 / 60 / 24)) days" h="$((s / 60 / 60 % 24)) hours" - m="$((s / 60 % 60)) mins" + m="$((s / 60 % 60)) minutes" # Remove plural if < 2. ((${d/ *} == 1)) && d=${d/s} @@ -1447,20 +1447,24 @@ get_uptime() { uptime=${d:+$d, }${h:+$h, }$m uptime=${uptime%', '} - uptime=${uptime:-$s secs} + uptime=${uptime:-$s seconds} # Make the output of uptime smaller. case $uptime_shorthand in - on) ;; + on) + uptime=${uptime/ minutes/ mins} + uptime=${uptime/ minute/ min} + uptime=${uptime/ seconds/ secs} + ;; tiny) uptime=${uptime/ days/d} uptime=${uptime/ day/d} uptime=${uptime/ hours/h} uptime=${uptime/ hour/h} - uptime=${uptime/ mins/m} - uptime=${uptime/ min/m} - uptime=${uptime/ secs/s} + uptime=${uptime/ minutes/m} + uptime=${uptime/ minute/m} + uptime=${uptime/ seconds/s} uptime=${uptime//,} ;; esac From 6f8d365deb07accaa728ffe0850abca53f561ee5 Mon Sep 17 00:00:00 2001 From: Simon Gredal Date: Sun, 27 Sep 2020 06:39:11 +0200 Subject: [PATCH 06/32] Fix CPU Temp. not showing up on Raspberry Pi (#1566) Added another possible name to the regex for finding cpu temperature. This was tested on a Raspberry Pi 4 running Arch Linux ARM. --- neofetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neofetch b/neofetch index c9a3e5cd..eaefbf23 100755 --- a/neofetch +++ b/neofetch @@ -2103,7 +2103,7 @@ get_cpu() { # Select the right temperature file. 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_dir=${temp_dirs[0]} break From 1a4fdc346f0c914585a282c8e7e2ed53af3fbc67 Mon Sep 17 00:00:00 2001 From: j-james <35242550+j-james@users.noreply.github.com> Date: Tue, 29 Sep 2020 21:44:09 -0700 Subject: [PATCH 07/32] Images: Reimplement catimg support (#1570) Fixes broken size parameter from the last implementation --- neofetch | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/neofetch b/neofetch index eaefbf23..7a8c22fb 100755 --- a/neofetch +++ b/neofetch @@ -744,7 +744,7 @@ disk_display="off" # Image backend. # # Default: 'ascii' -# Values: 'ascii', 'caca', 'chafa', 'jp2a', 'iterm2', 'off', +# Values: 'ascii', 'caca', 'catimg', 'chafa', 'jp2a', 'iterm2', 'off', # 'pot', 'termpix', 'pixterm', 'tycat', 'w3m', 'kitty' # Flag: --backend image_backend="ascii" @@ -881,6 +881,14 @@ crop_offset="center" # --size 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 # # Default: '3' @@ -3833,7 +3841,7 @@ image_backend() { "ascii") print_ascii ;; "off") image_backend="off" ;; - "caca" | "chafa" | "jp2a" | "iterm2" | "termpix" |\ + "caca" | "catimg" | "chafa" | "jp2a" | "iterm2" | "termpix" |\ "tycat" | "w3m" | "sixel" | "pixterm" | "kitty" | "pot") get_image_source @@ -3858,9 +3866,9 @@ image_backend() { *) err "Image: Unknown image backend specified '$image_backend'." - err "Image: Valid backends are: 'ascii', 'caca', 'chafa', 'jp2a', 'iterm2', 'kitty', - 'off', 'sixel', 'pot', 'pixterm', 'termpix', 'tycat', - 'w3m')" + err "Image: Valid backends are: 'ascii', 'caca', 'catimg', 'chafa', 'jp2a', 'iterm2', + 'kitty', 'off', 'sixel', 'pot', 'pixterm', 'termpix', + 'tycat', 'w3m')" err "Image: Falling back to ascii mode." print_ascii ;; @@ -4248,6 +4256,10 @@ display_image() { "$image" ;; + "catimg") + catimg -w "$((width*catimg_size / font_width))" -r "$catimg_size" "$image" + ;; + "chafa") chafa --stretch --size="$((width / font_width))x$((height / font_height))" "$image" ;; @@ -4885,8 +4897,8 @@ BARS: IMAGE BACKEND: --backend backend Which image backend to use. - Possible values: 'ascii', 'caca', 'chafa', 'jp2a', 'iterm2', - 'off', 'sixel', 'tycat', 'w3m', 'kitty' + Possible values: 'ascii', 'caca', 'catimg', 'chafa', 'jp2a', + 'iterm2', 'off', 'sixel', 'tycat', 'w3m', 'kitty' --source source Which image or ascii file to use. Possible values: 'auto', 'ascii', 'wallpaper', '/path/to/img', '/path/to/ascii', '/path/to/dir/', 'command output' [ascii] @@ -4896,6 +4908,7 @@ IMAGE BACKEND: NEW: neofetch --ascii \"\$(fortune | cowsay -W 30)\" --caca source Shortcut to use 'caca' backend. + --catimg source Shortcut to use 'catimg' backend. --chafa source Shortcut to use 'chafa' backend. --iterm2 source Shortcut to use 'iterm2' backend. --jp2a source Shortcut to use 'jp2a' backend. @@ -4969,6 +4982,7 @@ IMAGE: in some terminals emulators when using image mode. --size 00px | --size 00% How to size the image. Possible values: auto, 00px, 00%, none + --catimg_size 1/2 Change the resolution of catimg. --crop_mode mode Which crop mode to use Takes the values: normal, fit, fill --crop_offset value Change the crop offset for normal mode. @@ -5120,8 +5134,8 @@ get_args() { # Image backend "--backend") image_backend="$2" ;; "--source") image_source="$2" ;; - "--ascii" | "--caca" | "--chafa" | "--jp2a" | "--iterm2" | "--off" | "--pot" |\ - "--pixterm" | "--sixel" | "--termpix" | "--tycat" | "--w3m" | "--kitty") + "--ascii" | "--caca" | "--catimg" | "--chafa" | "--jp2a" | "--iterm2" | "--off" |\ + "--pot" | "--pixterm" | "--sixel" | "--termpix" | "--tycat" | "--w3m" | "--kitty") image_backend="${1/--}" case $2 in "-"* | "") ;; @@ -5132,6 +5146,7 @@ get_args() { # Image options "--loop") image_loop="on" ;; "--image_size" | "--size") image_size="$2" ;; + "--catimg_size") catimg_size="$2" ;; "--crop_mode") crop_mode="$2" ;; "--crop_offset") crop_offset="$2" ;; "--xoffset") xoffset="$2" ;; From 4b5f4e33beec42db4d3278ab92c7549656dc8202 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 4 Oct 2020 13:42:05 +0300 Subject: [PATCH 08/32] de/wm: Fix Windows 10 issues. Closes #1571, #1573 --- neofetch | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/neofetch b/neofetch index 0df70a8a..5ae16b32 100755 --- a/neofetch +++ b/neofetch @@ -1688,8 +1688,17 @@ get_de() { Windows) case $distro in - "Windows 8"*|"Windows 10"*) de="Modern UI/Metro" ;; - *) de=Aero + "Windows 10"*) + de=Fluent + ;; + + "Windows 8"*) + de=Metro + ;; + + *) + de=Aero + ;; esac ;; @@ -1870,15 +1879,21 @@ get_wm() { ;; Windows) - wm=$(tasklist | grep -m 1 -o -F \ - -e bugn \ - -e Windawesome \ - -e blackbox \ - -e emerge \ - -e litestep) + wm=$( + tasklist | - [[ $wm == blackbox ]] && wm="bbLean (Blackbox)" - wm=${wm:+$wm, }Explorer + grep -Fom 1 \ + -e bugn \ + -e Windawesome \ + -e blackbox \ + -e emerge \ + -e litestep + ) + + [[ $wm == blackbox ]] && + wm="bbLean (Blackbox)" + + wm=${wm:+$wm, }DWM.exe ;; FreeMiNT) From 77bac34cc5f406373ab31615a67f3eeb4c2609da Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 4 Oct 2020 13:53:30 +0300 Subject: [PATCH 09/32] general: drop cpu_usage. Always been unreliable. Never worked well. Closes #1551 --- neofetch | 44 +------------------------------------------- 1 file changed, 1 insertion(+), 43 deletions(-) diff --git a/neofetch b/neofetch index 4f6a04a6..9f824816 100755 --- a/neofetch +++ b/neofetch @@ -75,7 +75,6 @@ print_info() { info "Memory" memory # info "GPU Driver" gpu_driver # Linux/macOS only - # info "CPU Usage" cpu_usage # info "Disk" disk # info "Battery" battery # info "Font" font @@ -2365,47 +2364,6 @@ get_cpu() { 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() { case $os in "Linux") @@ -5258,7 +5216,6 @@ get_args() { info "GPU Driver" gpu_driver info "Memory" memory - info "CPU Usage" cpu_usage info "Disk" disk info "Battery" battery info "Font" font @@ -5311,6 +5268,7 @@ get_simple() { old_functions() { # Removed functions for backwards compatibility. get_line_break() { :; } + get_cpu_usage() { :; } } get_distro_ascii() { From fb572770362144915e3b47283c09f4a97ed31c3f Mon Sep 17 00:00:00 2001 From: Alan Griffiths Date: Sun, 4 Oct 2020 12:04:48 +0100 Subject: [PATCH 10/32] Better handling of Wayland compositors (#1539) * Better handling of Wayland compositors * Reinstate setting ps_flags, it's used elsewhere * Try another incantation * Try another incantation * Try another incantation * Use short options and a newline to reduce line-length * Rework to handle the "better way" failing on some systems and fall back to the old method (which has the virtue of working most of the time). --- neofetch | 66 +++++++++++++++++++++++++++++++------------------------- 1 file changed, 37 insertions(+), 29 deletions(-) diff --git a/neofetch b/neofetch index 9f824816..9752e09a 100755 --- a/neofetch +++ b/neofetch @@ -1815,35 +1815,43 @@ get_wm() { *) ps_flags=(-e) ;; esac - if [[ $WAYLAND_DISPLAY ]]; then - wm=$(ps "${ps_flags[@]}" | grep -m 1 -o -F \ - -e arcan \ - -e asc \ - -e clayland \ - -e dwc \ - -e fireplace \ - -e gnome-shell \ - -e greenfield \ - -e grefsen \ - -e kwin \ - -e lipstick \ - -e maynard \ - -e mazecompositor \ - -e motorcar \ - -e orbital \ - -e orbment \ - -e perceptia \ - -e rustland \ - -e sway \ - -e ulubis \ - -e velox \ - -e wavy \ - -e way-cooler \ - -e wayfire \ - -e wayhouse \ - -e westeros \ - -e westford \ - -e weston) + 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 \ + -e arcan \ + -e asc \ + -e clayland \ + -e dwc \ + -e fireplace \ + -e gnome-shell \ + -e greenfield \ + -e grefsen \ + -e kwin \ + -e lipstick \ + -e maynard \ + -e mazecompositor \ + -e motorcar \ + -e orbital \ + -e orbment \ + -e perceptia \ + -e rustland \ + -e sway \ + -e ulubis \ + -e velox \ + -e wavy \ + -e way-cooler \ + -e wayfire \ + -e wayhouse \ + -e westeros \ + -e westford \ + -e weston) + fi elif [[ $DISPLAY && $os != "Mac OS X" && $os != "macOS" && $os != FreeMiNT ]]; then type -p xprop &>/dev/null && { From a6137b26dbc9c4527f5468d5804652c729f47cb6 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 4 Oct 2020 14:11:56 +0300 Subject: [PATCH 11/32] de: Display Wayland if detected. Closes #1471 --- neofetch | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/neofetch b/neofetch index 9f824816..764a8415 100755 --- a/neofetch +++ b/neofetch @@ -1800,9 +1800,15 @@ get_de() { de_ver=${de_ver/* } de_ver=${de_ver//\"} - de="$de $de_ver" + de+=" $de_ver" 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 } From a4d9c557b3c7e55510bf4009537bc4963760e4d2 Mon Sep 17 00:00:00 2001 From: Julian Torreno Date: Sun, 4 Oct 2020 07:26:51 -0400 Subject: [PATCH 12/32] Remove extra newlines from get_cols (#1449) Co-authored-by: Julian Torreno --- neofetch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/neofetch b/neofetch index f53cd9b8..19e574fe 100755 --- a/neofetch +++ b/neofetch @@ -3807,8 +3807,8 @@ get_cols() { ((info_height+=block_range[1]>7?block_height+3:block_height+2)) case $col_offset in - "auto") printf '\n\e[%bC%b\n\n' "$text_padding" "${zws}${cols}" ;; - *) printf '\n\e[%bC%b\n\n' "$col_offset" "${zws}${cols}" ;; + "auto") printf '\n\e[%bC%b\n' "$text_padding" "${zws}${cols}" ;; + *) printf '\n\e[%bC%b\n' "$col_offset" "${zws}${cols}" ;; esac fi From 1c468b4e3163977ff47780e8534793cd7fe8bf75 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 4 Oct 2020 14:34:57 +0300 Subject: [PATCH 13/32] neofetch: Fix cursor placement issue --- neofetch | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/neofetch b/neofetch index 19e574fe..e336c53c 100755 --- a/neofetch +++ b/neofetch @@ -3804,7 +3804,7 @@ get_cols() { [${text_padding}C${zws}} # 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 "auto") printf '\n\e[%bC%b\n' "$text_padding" "${zws}${cols}" ;; @@ -3885,7 +3885,14 @@ print_ascii() { done <<< "${ascii_data//\$\{??\}}" # 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. ascii_data="${ascii_data//\$\{c1\}/$c1}" From 566c8096dad0c2eb8bc8bfba58ff031cd20b928e Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 4 Oct 2020 14:44:04 +0300 Subject: [PATCH 14/32] term_font: Fix st font2 issue. Closes #1446 --- neofetch | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/neofetch b/neofetch index e336c53c..4a900135 100755 --- a/neofetch +++ b/neofetch @@ -3409,15 +3409,16 @@ END # 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 # though it is hard to match it correctly amongst the rest of the noise. - [[ -n "$binary" ]] && \ - term_font="$(strings "$binary" | grep -F -m 1 \ - -e "pixelsize=" \ - -e "size=" \ - -e "antialias=" \ - -e "autohint=")" + [[ -n "$binary" ]] && + term_font=$( + strings "$binary" | + + grep -m 1 "*font[^2]" + ) fi term_font="${term_font/xft:}" + term_font="${term_font#*=}" term_font="${term_font/:*}" ;; From c155bdecd1c314b5f3744d553ad049b34bd42730 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 4 Oct 2020 14:50:26 +0300 Subject: [PATCH 15/32] wm: Fix issue with dwm. Closes #1433 --- neofetch | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/neofetch b/neofetch index 4a900135..249ab3fd 100755 --- a/neofetch +++ b/neofetch @@ -1860,7 +1860,19 @@ get_wm() { fi elif [[ $DISPLAY && $os != "Mac OS X" && $os != "macOS" && $os != FreeMiNT ]]; then - type -p xprop &>/dev/null && { + # non-EWMH WMs. + wm=$(ps "${ps_flags[@]}" | grep -m 1 -o \ + -e "[s]owm" \ + -e "[c]atwm" \ + -e "[f]vwm" \ + -e "[d]wm" \ + -e "[2]bwm" \ + -e "[m]onsterwm" \ + -e "[t]inywm" \ + -e "[x]11fs" \ + -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) @@ -1869,19 +1881,6 @@ get_wm() { wm=${wm/\"*} } - # Fallback for non-EWMH WMs. - [[ $wm ]] || - wm=$(ps "${ps_flags[@]}" | grep -m 1 -o \ - -e "[s]owm" \ - -e "[c]atwm" \ - -e "[f]vwm" \ - -e "[d]wm" \ - -e "[2]bwm" \ - -e "[m]onsterwm" \ - -e "[t]inywm" \ - -e "[x]11fs" \ - -e "[x]monad") - else case $os in "Mac OS X"|"macOS") From f730fc6a81b939dccdedd1a7d630b0cd40cb3810 Mon Sep 17 00:00:00 2001 From: Andrea Canepa <32621046+A-725-K@users.noreply.github.com> Date: Sun, 4 Oct 2020 13:53:30 +0200 Subject: [PATCH 16/32] Wrong number of packages reported for some package managers (#1556) * Wrong number of snap packages reported: fixed for snap (#1274) * Adjusted indentation and improved packages count (#1274) * Fixed spacing in empty lines --- neofetch | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/neofetch b/neofetch index 249ab3fd..aca6d003 100755 --- a/neofetch +++ b/neofetch @@ -1478,21 +1478,28 @@ get_uptime() { } get_packages() { + # to adjust the number of pkgs per pkg manager + pkgs_h=0 + # has: Check if package manager installed. # dir: Count files or dirs in a glob. # pac: If packages > 0, log package manager name. # tot: Count lines in command output. 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}, "; }; } - 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. [[ -f /bedrock/etc/bedrock-release && $PATH == */bedrock/cross/* ]] && { tot() { IFS=$'\n' read -d "" -ra pkgs <<< "$(for s in $(brl list); do strat -r "$s" "$@"; done)" ((packages+="${#pkgs[@]}")) - pac "${#pkgs[@]}" + pac "$((${#pkgs[@]}-pkgs_h))"; } br_prefix="/bedrock/strata/*" } @@ -1512,7 +1519,7 @@ get_packages() { has lvu && tot lvu installed has tce-status && tot tce-status -i 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 alps && tot alps showinstalled has butch && tot butch list @@ -1573,7 +1580,8 @@ get_packages() { # Snap hangs if the command is run without the daemon 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. # See: https://github.com/AppImage/AppImageKit/wiki @@ -1581,7 +1589,7 @@ get_packages() { ;; "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 pkgin && tot pkgin list @@ -1603,9 +1611,9 @@ get_packages() { esac # 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 ]] && \ dir /cygdrive/c/ProgramData/chocolatey/lib/* ;; @@ -1613,11 +1621,11 @@ get_packages() { Haiku) has pkgman && dir /boot/system/package-links/* packages=${packages/pkgman/depot} - ;; - + ;; + IRIX) manager=swpkg - tot versions -b && ((packages-=3)) + pkgs_h=3 tot versions -b && ((packages-=3)) ;; esac From 6dca2c4037c35c71e9c676908070296087541974 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Sun, 4 Oct 2020 13:56:51 +0200 Subject: [PATCH 17/32] os: Add Univention (#1572) --- neofetch | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/neofetch b/neofetch index aca6d003..6c4b02b3 100755 --- a/neofetch +++ b/neofetch @@ -10242,6 +10242,32 @@ oss${c2}yNMMMNyMMh${c1}sssssssssssssshmmmh${c1}ssssssso 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"*) set_colors 8 4 read -rd '' ascii_data <<'EOF' From 1cd67b9f9ae45ceb095ee8f022c8dab3b6620d0a Mon Sep 17 00:00:00 2001 From: RhinoCodes <51250021+RhinoCodes@users.noreply.github.com> Date: Sun, 4 Oct 2020 06:57:09 -0500 Subject: [PATCH 18/32] Add semcOS (#1567) --- neofetch | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/neofetch b/neofetch index 6c4b02b3..6cdff4fd 100755 --- a/neofetch +++ b/neofetch @@ -10324,6 +10324,36 @@ ${c1} -1vvnvv. `~+++` ++|+++ ~|Invnvnvvnvvvnnv}+` -~|{*l}*|~ 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"*) From 19af3abaee51460ea5ed137c09776ca7269e0a16 Mon Sep 17 00:00:00 2001 From: Aditya Shakya Date: Sun, 4 Oct 2020 17:27:24 +0530 Subject: [PATCH 19/32] Added Archcraft OS (#1547) --- neofetch | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/neofetch b/neofetch index 6cdff4fd..2e9700ab 100755 --- a/neofetch +++ b/neofetch @@ -5630,6 +5630,30 @@ dhhyys+/-` 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"*) set_colors 7 4 read -rd '' ascii_data <<'EOF' From 314a0bc4f6bf1801dcd015f84e5ae8d6d973144f Mon Sep 17 00:00:00 2001 From: Rising Thumb Date: Sun, 4 Oct 2020 13:00:26 +0100 Subject: [PATCH 20/32] =?UTF-8?q?=C3=9Cberzug=20image=20support=20(#1562)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Support for Ueberzug backend * Ueberzug cli argument * Fixed slight issues according to shellcheck * Read output suppressed * --xoffset and --yoffset support Co-authored-by: dylan --- neofetch | 32 +++++++++++++++++++++++++++----- neofetch.1 | 9 ++++++--- 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/neofetch b/neofetch index 2e9700ab..e80541ed 100755 --- a/neofetch +++ b/neofetch @@ -744,7 +744,8 @@ disk_display="off" # # Default: 'ascii' # Values: 'ascii', 'caca', 'catimg', 'chafa', 'jp2a', 'iterm2', 'off', -# 'pot', 'termpix', 'pixterm', 'tycat', 'w3m', 'kitty' +# 'pot', 'termpix', 'pixterm', 'tycat', 'w3m', 'kitty', 'ueberzug' + # Flag: --backend image_backend="ascii" @@ -3837,13 +3838,14 @@ image_backend() { "off") image_backend="off" ;; "caca" | "catimg" | "chafa" | "jp2a" | "iterm2" | "termpix" |\ - "tycat" | "w3m" | "sixel" | "pixterm" | "kitty" | "pot") + "tycat" | "w3m" | "sixel" | "pixterm" | "kitty" | "pot", | "ueberzug") get_image_source [[ ! -f "$image" ]] && { to_ascii "Image: '$image_source' doesn't exist, falling back to ascii mode." return } + [[ "$image_backend" == "ueberzug" ]] && wait=true; get_window_size @@ -4258,6 +4260,24 @@ display_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" ;; @@ -4921,6 +4941,7 @@ IMAGE BACKEND: --termpix source Shortcut to use 'termpix' backend. --tycat source Shortcut to use 'tycat' backend. --w3m source Shortcut to use 'w3m' backend. + --ueberzug source Shortcut to use 'ueberzug' backend --off Shortcut to use 'off' backend (Disable ascii art). NOTE: 'source; can be any of the following: 'auto', 'ascii', 'wallpaper', '/path/to/img', @@ -5135,9 +5156,9 @@ get_args() { # Image backend "--backend") image_backend="$2" ;; - "--source") image_source="$2" ;; - "--ascii" | "--caca" | "--catimg" | "--chafa" | "--jp2a" | "--iterm2" | "--off" |\ - "--pot" | "--pixterm" | "--sixel" | "--termpix" | "--tycat" | "--w3m" | "--kitty") + "--source") image_source="$2" ;; + "--ascii" | "--caca" | "--catimg" | "--chafa" | "--jp2a" | "--iterm2" | "--off" | "--pot" |\ + "--pixterm" | "--sixel" | "--termpix" | "--tycat" | "--w3m" | "--kitty" | "--ueberzug") image_backend="${1/--}" case $2 in "-"* | "") ;; @@ -10726,6 +10747,7 @@ main() { # w3m-img: Draw the image a second time to fix # rendering issues in specific terminal emulators. [[ $image_backend == *w3m* ]] && display_image + [[ $image_backend == *ueberzug* ]] && display_image # Add neofetch info to verbose output. err "Neofetch command: $0 $*" diff --git a/neofetch.1 b/neofetch.1 index 5cadd702..4a766043 100644 --- a/neofetch.1 +++ b/neofetch.1 @@ -235,7 +235,7 @@ Possible values: bar, infobar, barinfo, off \fB\-\-backend\fR backend Which image backend to use. Possible values: 'ascii', 'caca', 'chafa', 'jp2a', 'iterm2', -\&'off', 'sixel', 'tycat', 'w3m', 'kitty' +\&'off', 'sixel', 'tycat', 'w3m', 'kitty', 'ueberzug' .TP \fB\-\-source\fR source Which image or ascii file to use. @@ -280,6 +280,9 @@ Shortcut to use 'tycat' backend. \fB\-\-w3m\fR source Shortcut to use 'w3m' backend. .TP +\fB\-\-ueberzug\fR source +Shortcut to use 'ueberzug' backend. +.TP \fB\-\-off\fR Shortcut to use 'off' backend (Disable ascii art). .IP @@ -365,11 +368,11 @@ west, center, east, southwest, south, southeast .TP \fB\-\-xoffset\fR px 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 \fB\-\-yoffset\fR px 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 \fB\-\-bg_color\fR color Background color to display behind transparent image. From f3991ad97024b8766a9f1531462e4e40a7aa4284 Mon Sep 17 00:00:00 2001 From: manzoor ahmed Date: Sun, 4 Oct 2020 17:03:28 +0500 Subject: [PATCH 21/32] add LaxerOS (#1541) --- neofetch | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/neofetch b/neofetch index e80541ed..561d9413 100755 --- a/neofetch +++ b/neofetch @@ -7723,6 +7723,34 @@ EOF \ LE \ / \ DE \ / \________\/ +EOF + ;; + + "LaxerOS"*) + set_colors 7 4 + read -rd '' ascii_data <<'EOF' +${c2} + /. + `://:- + `//////: + .////////:` + -//////////:` + -/////////////` + :///////////////. + `://////.```-//////- + `://///:` .//////- + `//////: `//////: + .//////- `://///:` + -//////- `://///:` + -//////. ://////` + ://////` -//////. + `/////:` ./////: + .-::-` .:::-` + +.:://////////////////////////////////::. +//////////////////////////////////////// +.:////////////////////////////////////:. + EOF ;; From 60d090164dc25c5d63698151feccdba7afac49d6 Mon Sep 17 00:00:00 2001 From: paperbenni Date: Sun, 4 Oct 2020 14:03:57 +0200 Subject: [PATCH 22/32] Update neofetch (#1537) --- neofetch | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/neofetch b/neofetch index 561d9413..04bb10d5 100755 --- a/neofetch +++ b/neofetch @@ -5533,6 +5533,34 @@ ${c1} -o o- 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"*) set_colors 4 6 read -rd '' ascii_data <<'EOF' From d8e957cb0d4204d144f964941ec58fae11bbb8e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charl=C3=A8ne?= Date: Sun, 4 Oct 2020 14:05:34 +0200 Subject: [PATCH 23/32] Improve glxinfo call, OpenBSD sensors fix (#1494) * Use `glxinfo -B' instead of `glxinfo' It's enough to get the gpu infos and it's way faster. * OpenBSD: fix cpu sensors informations, add ksmn(4) and adt(4) --- neofetch | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/neofetch b/neofetch index 04bb10d5..ae42adbd 100755 --- a/neofetch +++ b/neofetch @@ -2246,8 +2246,7 @@ get_cpu() { ;; "OpenBSD"* | "Bitrig"*) deg="$(sysctl hw.sensors | \ - awk -F '=| degC' '/lm0.temp|cpu0.temp/ {print $2; exit}')" - deg="${deg/00/0}" + awk -F'=|degC' '/(ksmn|adt|lm|cpu)0.temp0/ {printf("%2.1f", $2); exit}')" ;; esac ;; @@ -2529,7 +2528,7 @@ get_gpu() { ;; *) - gpu="$(glxinfo | grep -F 'OpenGL renderer string')" + gpu="$(glxinfo -B | grep -F 'OpenGL renderer string')" gpu="${gpu/OpenGL renderer string: }" ;; esac From 6b26a4d688ae8f2e71cc95471be247d1d4ee5c04 Mon Sep 17 00:00:00 2001 From: Alex Mirrington <34053287+alexmirrington@users.noreply.github.com> Date: Sun, 4 Oct 2020 23:05:59 +1100 Subject: [PATCH 24/32] Update raspbian_small ascii art (#1483) * Update raspbian_small ascii art * Escape rogue backslash --- neofetch | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/neofetch b/neofetch index ae42adbd..57df2210 100755 --- a/neofetch +++ b/neofetch @@ -9282,16 +9282,15 @@ EOF "Raspbian_small"*) set_colors 2 1 read -rd '' ascii_data <<'EOF' -${c1} .~~. .~~. - '. \\ ' ' / .' -${c2} .~ .~~~..~. - : .~.'~'.~. : - ~ ( ) ( ) ~ -( : '~'.~.'~' : ) - ~ .~ ( ) ~. ~ - ( : '~' : ) - '~ .~~~. ~' - '~' +${c1} .. ,. + :oo: .:oo: + 'o\\o o/o: +${c2} :: . :: . :: +:: ::: ::: :: +:' '',.'' ': + ::: :::: ::: + ':, '' ,:' + ' ~::~ ' EOF ;; From d76815d3a245bc7acbaf839e663b6c4bde87abf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Pe=C4=8Dovnik?= Date: Sun, 4 Oct 2020 14:06:25 +0200 Subject: [PATCH 25/32] Add Armbian Linux (#1417) * Add Armbian Linux * Update neofetch * Update neofetch --- neofetch | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/neofetch b/neofetch index 57df2210..196246b4 100755 --- a/neofetch +++ b/neofetch @@ -976,6 +976,10 @@ get_distro() { *) distro="Red Star OS $(awk -F'[^0-9*]' '$0=$2' /etc/redstar-release)" esac + elif [[ -f /etc/armbian-release ]]; then + . /etc/armbian-release + distro="Armbian $DISTRIBUTION_CODENAME ($VERSION)" + elif [[ -f /etc/siduction-version ]]; then case $distro_shorthand in on|tiny) distro=Siduction ;; From 9ca24eaa0ac41b70d84c7db0ee321f7520860333 Mon Sep 17 00:00:00 2001 From: Andrew Titmuss Date: Sun, 4 Oct 2020 23:09:36 +1100 Subject: [PATCH 26/32] local_ip: Add interface selection (#1327) * local_ip: add interface selection local_ip: add interface selection for macOS local_ip: add interface support for Linux and others local_ip: fix quotes local_ip: fix line length local_ip: fix line length for realsies this time * local ip: change default to auto and simplify if statement * local ip: make error for invalid interface actually work on linux * local ip: remove unneeded slash * local ip: silence errors from ip and ifconfig Co-authored-by: dylan --- neofetch | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 51 insertions(+), 5 deletions(-) diff --git a/neofetch b/neofetch index 196246b4..633328af 100755 --- a/neofetch +++ b/neofetch @@ -407,6 +407,13 @@ public_ip_host="http://ident.me" # Flag: --ip_timeout 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 @@ -3702,9 +3709,25 @@ get_battery() { get_local_ip() { case $os in "Linux" | "BSD" | "Solaris" | "AIX" | "IRIX") - local_ip="$(ip route get 1 | awk -F'src' '{print $2; exit}')" - local_ip="${local_ip/uid*}" - [[ -z "$local_ip" ]] && local_ip="$(ifconfig -a | awk '/broadcast/ {print $2; exit}')" + if [[ "${local_ip_interface[0]}" == "auto" ]]; then + local_ip="$(ip route get 1 | awk -F'src' '{print $2; exit}')" + local_ip="${local_ip/uid*}" + [[ "$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") @@ -3712,8 +3735,19 @@ get_local_ip() { ;; "Mac OS X" | "macOS" | "iPhone OS") - local_ip="$(ipconfig getifaddr en0)" - [[ -z "$local_ip" ]] && local_ip="$(ipconfig getifaddr en1)" + if [[ "${local_ip_interface[0]}" == "auto" ]]; then + 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") @@ -4882,6 +4916,7 @@ INFO: --ip_host url URL to query for public IP --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_shorthand on/off Print the Artist/Album/Title on separate lines. --memory_percent on/off Display memory percentage. @@ -5078,6 +5113,17 @@ get_args() { "--shell_version") shell_version="$2" ;; "--ip_host") public_ip_host="$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_shorthand") song_shorthand="$2" ;; "--music_player") music_player="$2" ;; From 075eb43dd77cddcbe5f41706c9676ae29be0291f Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 4 Oct 2020 15:18:28 +0300 Subject: [PATCH 27/32] neofetch: clean up --- neofetch | 114 ++++++++++++++++++++++++++----------------------------- 1 file changed, 54 insertions(+), 60 deletions(-) diff --git a/neofetch b/neofetch index 633328af..60ef7d94 100755 --- a/neofetch +++ b/neofetch @@ -728,8 +728,7 @@ bar_color_total="distro" # # Default: 'off' # Values: 'bar', 'infobar', 'barinfo', 'off' -# Flags: --cpu_display -# --memory_display +# Flags: --memory_display # --battery_display # --disk_display # @@ -738,7 +737,6 @@ bar_color_total="distro" # infobar: 'info [---=======]' # barinfo: '[---=======] info' # off: 'info' -cpu_display="off" memory_display="off" battery_display="off" disk_display="off" @@ -985,7 +983,7 @@ get_distro() { elif [[ -f /etc/armbian-release ]]; then . /etc/armbian-release - distro="Armbian $DISTRIBUTION_CODENAME ($VERSION)" + distro="Armbian $DISTRIBUTION_CODENAME (${VERSION:-})" elif [[ -f /etc/siduction-version ]]; then case $distro_shorthand in @@ -1500,7 +1498,7 @@ get_packages() { has() { type -p "$1" >/dev/null && manager=$1; } dir() { ((packages+=$#)); pac "$(($#-pkgs_h))"; } pac() { (($1 > 0)) && { managers+=("$1 (${manager})"); manager_string+="${manager}, "; }; } - tot() { + tot() { IFS=$'\n' read -d "" -ra pkgs <<< "$("$@")"; ((packages+=${#pkgs[@]})); pac "$((${#pkgs[@]}-pkgs_h))"; @@ -1634,7 +1632,7 @@ get_packages() { has pkgman && dir /boot/system/package-links/* packages=${packages/pkgman/depot} ;; - + IRIX) manager=swpkg pkgs_h=3 tot versions -b && ((packages-=3)) @@ -4314,7 +4312,7 @@ display_image() { ) fi ;; - + "catimg") catimg -w "$((width*catimg_size / font_width))" -r "$catimg_size" "$image" ;; @@ -4946,8 +4944,6 @@ BARS: --bar_length num Length in spaces to make the bars. --bar_colors num num Colors to make the bar. Set in this order: elapsed, total - --cpu_display mode Bar mode. - Possible values: bar, infobar, barinfo, off --memory_display mode Bar mode. Possible values: bar, infobar, barinfo, off --battery_display mode Bar mode. @@ -5198,14 +5194,13 @@ get_args() { bar_color_total="$3" ;; - "--cpu_display") cpu_display="$2" ;; "--memory_display") memory_display="$2" ;; "--battery_display") battery_display="$2" ;; "--disk_display") disk_display="$2" ;; # Image backend "--backend") image_backend="$2" ;; - "--source") image_source="$2" ;; + "--source") image_source="$2" ;; "--ascii" | "--caca" | "--catimg" | "--chafa" | "--jp2a" | "--iterm2" | "--off" | "--pot" |\ "--pixterm" | "--sixel" | "--termpix" | "--tycat" | "--w3m" | "--kitty" | "--ueberzug") image_backend="${1/--}" @@ -5336,7 +5331,6 @@ get_args() { refresh_rate="on" shell_version="on" - cpu_display="infobar" memory_display="infobar" disk_display="infobar" cpu_temp="C" @@ -5587,26 +5581,26 @@ EOF 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:. + '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. + .o0NMWNOc. EOF ;; @@ -5731,24 +5725,24 @@ 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: +${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 + +MMMMMMo .dMm. `o. +MMMMMMo +sMMMMMM+ .mMMMN: :` :NMMMMMy EOF ;; @@ -7806,24 +7800,24 @@ EOF "LaxerOS"*) set_colors 7 4 read -rd '' ascii_data <<'EOF' -${c2} +${c2} /. - `://:- - `//////: - .////////:` - -//////////:` - -/////////////` - :///////////////. - `://////.```-//////- - `://///:` .//////- - `//////: `//////: - .//////- `://///:` - -//////- `://///:` - -//////. ://////` - ://////` -//////. - `/////:` ./////: + `://:- + `//////: + .////////:` + -//////////:` + -/////////////` + :///////////////. + `://////.```-//////- + `://///:` .//////- + `//////: `//////: + .//////- `://///:` + -//////- `://///:` + -//////. ://////` + ://////` -//////. + `/////:` ./////: .-::-` .:::-` - + .:://////////////////////////////////::. //////////////////////////////////////// .:////////////////////////////////////:. @@ -10500,7 +10494,7 @@ ${c1} -1vvnvv. `~+++` ++|+++ +Invnvnvnnnnnnnnvvnn;. ~|Invnvnvvnvvvnnv}+` -~|{*l}*|~ - + EOF ;; From c511bcbcef44db3b05c885191ebd170ebaf15574 Mon Sep 17 00:00:00 2001 From: Rashil Gandhi <46838874+rashil2000@users.noreply.github.com> Date: Sun, 4 Oct 2020 19:07:50 +0530 Subject: [PATCH 28/32] Display charging status in Windows (#1575) --- neofetch | 3 +++ 1 file changed, 3 insertions(+) diff --git a/neofetch b/neofetch index 60ef7d94..3e93ed79 100755 --- a/neofetch +++ b/neofetch @@ -3686,6 +3686,9 @@ get_battery() { battery="$(wmic Path Win32_Battery get EstimatedChargeRemaining)" battery="${battery/EstimatedChargeRemaining}" battery="$(trim "$battery")%" + state="$(wmic /NameSpace:'\\root\WMI' Path BatteryStatus get Charging)" + state="${state/Charging}" + [[ "$state" == *TRUE* ]] && battery_state="charging" ;; "Haiku") From 71d8914ec7a30e42e800253433eae10bc1b43869 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 4 Oct 2020 18:05:18 +0300 Subject: [PATCH 29/32] windows: Fix gpu output --- neofetch | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/neofetch b/neofetch index 3e93ed79..f88f5c95 100755 --- a/neofetch +++ b/neofetch @@ -2517,10 +2517,13 @@ get_gpu() { "Windows") while read -r line; do + [[ $win_gpu ]] || { + win_gpu=1 + continue + } + prin "${subtitle:+${subtitle}${gpu_name}}" "$(trim "$line")" done < <(wmic path Win32_VideoController get caption) - - gpu=${gpu//Caption} ;; "Haiku") From c93f3dabd6ab578bf055165c813ef80bc9829a57 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 4 Oct 2020 18:26:26 +0300 Subject: [PATCH 30/32] gpu: Fix blank line in output on Windows. --- neofetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neofetch b/neofetch index f88f5c95..477a9b24 100755 --- a/neofetch +++ b/neofetch @@ -2517,7 +2517,7 @@ get_gpu() { "Windows") while read -r line; do - [[ $win_gpu ]] || { + [[ -z $win_gpu ]] || [[ -z "$line" ]] && { win_gpu=1 continue } From 7bf2ecee26adf67165a370e7510631914a5f47d2 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 4 Oct 2020 18:46:04 +0300 Subject: [PATCH 31/32] fix ci --- neofetch | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/neofetch b/neofetch index 477a9b24..e5e7dbbb 100755 --- a/neofetch +++ b/neofetch @@ -5207,8 +5207,9 @@ get_args() { # Image backend "--backend") image_backend="$2" ;; "--source") image_source="$2" ;; - "--ascii" | "--caca" | "--catimg" | "--chafa" | "--jp2a" | "--iterm2" | "--off" | "--pot" |\ - "--pixterm" | "--sixel" | "--termpix" | "--tycat" | "--w3m" | "--kitty" | "--ueberzug") + "--ascii" | "--caca" | "--catimg" | "--chafa" | "--jp2a" | "--iterm2" | "--off" |\ + "--pot" | "--pixterm" | "--sixel" | "--termpix" | "--tycat" | "--w3m" | "--kitty" |\ + "--ueberzug") image_backend="${1/--}" case $2 in "-"* | "") ;; From 4660ae7a53d61a90a66dc5634367a8e357bfb135 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 4 Oct 2020 19:05:03 +0300 Subject: [PATCH 32/32] various: fix windows issues --- neofetch | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/neofetch b/neofetch index e5e7dbbb..ba183598 100755 --- a/neofetch +++ b/neofetch @@ -1718,11 +1718,11 @@ get_de() { Windows) case $distro in - "Windows 10"*) + *"Windows 10"*) de=Fluent ;; - "Windows 8"*) + *"Windows 8"*) de=Metro ;; @@ -2517,12 +2517,14 @@ get_gpu() { "Windows") while read -r line; do + line=$(trim "$line") + [[ -z $win_gpu ]] || [[ -z "$line" ]] && { win_gpu=1 continue } - prin "${subtitle:+${subtitle}${gpu_name}}" "$(trim "$line")" + prin "${subtitle:+${subtitle}${gpu_name}}" "$line" done < <(wmic path Win32_VideoController get caption) ;;