From b93eb5ad30bce0531f399a103dcbad810211373f Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Thu, 31 May 2018 07:33:20 +1000 Subject: [PATCH 01/82] w3m: Simplify path find. --- neofetch | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/neofetch b/neofetch index 5325d01c..d421bf40 100755 --- a/neofetch +++ b/neofetch @@ -3571,27 +3571,17 @@ END get_w3m_img_path() { # Find w3m-img path. - if [[ -x "/usr/lib/w3m/w3mimgdisplay" ]]; then - w3m_img_path="/usr/lib/w3m/w3mimgdisplay" + shopt -s nullglob + w3m_paths=( + /usr/{local/,}{lib,libexec,lib64,libexec64}/w3m/w3mi* + ~/.nix-profile/libexec/w3m/w3mi* + ) + shopt -u nullglob - elif [[ -x "/usr/libexec/w3m/w3mimgdisplay" ]]; then - w3m_img_path="/usr/libexec/w3m/w3mimgdisplay" + [[ -x "${w3m_paths[0]}" ]] && \ + { w3m_img_path="${w3m_paths[0]}"; return; } - elif [[ -x "/usr/lib64/w3m/w3mimgdisplay" ]]; then - w3m_img_path="/usr/lib64/w3m/w3mimgdisplay" - - elif [[ -x "/usr/libexec64/w3m/w3mimgdisplay" ]]; then - w3m_img_path="/usr/libexec64/w3m/w3mimgdisplay" - - elif [[ -x "/usr/local/libexec/w3m/w3mimgdisplay" ]]; then - w3m_img_path="/usr/local/libexec/w3m/w3mimgdisplay" - - elif [[ -x "$HOME/.nix-profile/libexec/w3m/w3mimgdisplay" ]]; then - w3m_img_path="$HOME/.nix-profile/libexec/w3m/w3mimgdisplay" - - else - err "Image: w3m-img wasn't found on your system" - fi + err "Image: w3m-img wasn't found on your system" } get_term_size() { From c6fde1ff9afcd41a9a2289677f1312a1fbc5b56a Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Thu, 31 May 2018 08:04:01 +1000 Subject: [PATCH 02/82] ascii: Simplify function. --- neofetch | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/neofetch b/neofetch index d421bf40..f9c43947 100755 --- a/neofetch +++ b/neofetch @@ -3418,17 +3418,8 @@ image_backend() { } get_ascii() { - if [[ ! -f "$image_source" || - "$image_source" =~ ^(auto|ascii)$ || - "$image_source" =~ \.(png|jpg|jpe|jpeg|gif)$ ]]; then - - # Fallback to distro ascii mode if custom ascii isn't found. - [[ ! "$image_source" =~ ^(auto|ascii)$ ]] && \ - err "Ascii: Ascii file not found, using distro ascii." - - # Fallback to distro ascii mode if source is an image. - [[ "$image_source" =~ \.(png|jpg|jpe|jpeg|gif)$ ]] && \ - err "Image: Source is image file but ascii backend was selected. Using distro ascii." + if [[ ! -f "$image_source" ]]; then + err "Ascii: Ascii file not found, using distro ascii." else ascii_data="$(< "$image_source")" fi @@ -3458,10 +3449,7 @@ get_ascii() { print="${print//'${c5}'/$c5}" print="${print//'${c6}'/$c6}" - # Overwrite padding if ascii_length_force is set. - [[ "$ascii_length_force" ]] && ascii_length="$ascii_length_force" - - text_padding="$((ascii_length + gap))" + ((text_padding=ascii_length+gap)) printf "%b" "$print" LC_ALL=C } From 077e5fadb7b04c9b5dcacb67c92f55b04a4c73b3 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Thu, 31 May 2018 08:10:43 +1000 Subject: [PATCH 03/82] w3m: Simplify function further. --- neofetch | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/neofetch b/neofetch index f9c43947..5bffeb3c 100755 --- a/neofetch +++ b/neofetch @@ -3560,10 +3560,7 @@ END get_w3m_img_path() { # Find w3m-img path. shopt -s nullglob - w3m_paths=( - /usr/{local/,}{lib,libexec,lib64,libexec64}/w3m/w3mi* - ~/.nix-profile/libexec/w3m/w3mi* - ) + w3m_paths=({/usr/{local/,},~/.nix-profile/}{lib,libexec,lib64,libexec64}/w3m/w3mi*) shopt -u nullglob [[ -x "${w3m_paths[0]}" ]] && \ From f41607c36c01efee201e1019f12de730a3f70afc Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Thu, 31 May 2018 14:30:48 +1000 Subject: [PATCH 04/82] cpu: Use HOSTTYPE --- neofetch | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/neofetch b/neofetch index 5bffeb3c..04fe8192 100755 --- a/neofetch +++ b/neofetch @@ -996,15 +996,8 @@ get_distro() { [[ -z "$distro" ]] && distro="$os (Unknown)" - # Get OS architecture. - case "$os" in - "Solaris" | "AIX" | "Haiku" | "IRIX" | "FreeMiNT") machine_arch="$(uname -p)" ;; - *) machine_arch="$(uname -m)" ;; - - esac - [[ "$os_arch" == "on" ]] && \ - distro+=" ${machine_arch}" + distro+=" $HOSTTYPE" [[ "${ascii_distro:-auto}" == "auto" ]] && \ ascii_distro="$(trim "$distro")" @@ -1038,7 +1031,7 @@ get_model() { ;; "iPhone OS") - case "$machine_arch" in + case "$kernel_machine" in "iPad1,1") model="iPad" ;; "iPad2,"[1-4]) model="iPad 2" ;; "iPad3,"[1-3]) model="iPad 3" ;; @@ -1739,7 +1732,7 @@ get_cpu() { # Get CPU name. cpu_file="/proc/cpuinfo" - case "$machine_arch" in + case "$kernel_machine" in "frv" | "hppa" | "m68k" | "openrisc" | "or"* | "powerpc" | "ppc"* | "sparc"*) cpu="$(awk -F':' '/^cpu\t|^CPU/ {printf $2; exit}' "$cpu_file")" ;; @@ -1808,7 +1801,7 @@ get_cpu() { ;; "iPhone OS") - case "$machine_arch" in + case "$kernel_machine" in "iPhone1,"[1-2] | "iPod1,1") cpu="Samsung S5L8900 (1) @ 412MHz" ;; "iPhone2,1") cpu="Samsung S5PC100 (1) @ 600MHz" ;; "iPhone3,"[1-3] | "iPod4,1") cpu="Apple A4 (1) @ 800MHz" ;; @@ -2119,7 +2112,7 @@ get_gpu() { ;; "iPhone OS") - case "$machine_arch" in + case "$kernel_machine" in "iPhone1,"[1-2]) gpu="PowerVR MBX Lite 3D" ;; "iPhone5,"[1-4]) gpu="PowerVR SGX543MP3" ;; "iPhone8,"[1-4]) gpu="PowerVR GT7600" ;; @@ -4188,10 +4181,11 @@ dynamic_prompt() { cache_uname() { # Cache the output of uname so we don't # have to spawn it multiple times. - IFS=" " read -ra uname <<< "$(uname -sr)" + IFS=" " read -ra uname <<< "$(uname -srm)" kernel_name="${uname[0]}" kernel_version="${uname[1]}" + kernel_machine="${uname[2]}" } convert_time() { From 2bb28bb67b08b2f3f8fee2a0f2087b26770ca7fa Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Thu, 31 May 2018 15:01:20 +1000 Subject: [PATCH 05/82] cpu: Use uname -m for portability --- neofetch | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/neofetch b/neofetch index 04fe8192..a14120b3 100755 --- a/neofetch +++ b/neofetch @@ -996,8 +996,14 @@ get_distro() { [[ -z "$distro" ]] && distro="$os (Unknown)" + # Get OS architecture. + case "$os" in + "Solaris" | "AIX" | "Haiku" | "IRIX" | "FreeMiNT") machine_arch="$(uname -p)" ;; + *) machine_arch="$kernel_machine" ;; + esac + [[ "$os_arch" == "on" ]] && \ - distro+=" $HOSTTYPE" + distro+=" $machine_arch" [[ "${ascii_distro:-auto}" == "auto" ]] && \ ascii_distro="$(trim "$distro")" From 6244bbb1da67fc11128be6366435459381612edb Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Thu, 31 May 2018 15:05:22 +1000 Subject: [PATCH 06/82] os: cleanup --- neofetch | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/neofetch b/neofetch index a14120b3..f93c9009 100755 --- a/neofetch +++ b/neofetch @@ -782,16 +782,26 @@ get_os() { # $kernel_name is set in a function called cache_uname and is # just the output of "uname -s". case "$kernel_name" in - "Linux" | "GNU"*) os="Linux" ;; - "Darwin") os="$(sw_vers -productName)" ;; - *"BSD" | "DragonFly" | "Bitrig") os="BSD" ;; - "CYGWIN"* | "MSYS"* | "MINGW"*) os="Windows" ;; - "SunOS") os="Solaris" ;; - "Haiku") os="Haiku" ;; - "MINIX") os="MINIX" ;; - "AIX") os="AIX" ;; - "IRIX"*) os="IRIX" ;; + "Darwin") os="$(sw_vers -productName)" ;; + "SunOS") os="Solaris" ;; + "Haiku") os="Haiku" ;; + "MINIX") os="MINIX" ;; + "AIX") os="AIX" ;; + "IRIX"*) os="IRIX" ;; "FreeMiNT") os="FreeMiNT" ;; + + "Linux" | "GNU"*) + os="Linux" + ;; + + *"BSD" | "DragonFly" | "Bitrig") + os="BSD" + ;; + + "CYGWIN"* | "MSYS"* | "MINGW"*) + os="Windows" + ;; + *) printf "%s\n" "Unknown OS detected: '$kernel_name', aborting..." >&2 printf "%s\n" "Open an issue on GitHub to add support for your OS." >&2 From ea7512da2f11cdf6da40d607593f0b30d0c62e48 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Thu, 31 May 2018 15:09:48 +1000 Subject: [PATCH 07/82] misc: cleanup --- neofetch | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/neofetch b/neofetch index f93c9009..ce1743d3 100755 --- a/neofetch +++ b/neofetch @@ -867,7 +867,7 @@ get_distro() { # Chrome OS doesn't conform to the /etc/*-release standard. # While the file is a series of variables they can't be sourced # by the shell since the values aren't quoted. - elif [[ -f "/etc/lsb-release" && "$(< /etc/lsb-release)" == *CHROMEOS* ]]; then + elif [[ "$(< /etc/lsb-release)" == *CHROMEOS* ]]; then distro="$(awk -F '=' '/NAME|VERSION/ {printf $2 " "}' /etc/lsb-release)" elif [[ -f "/etc/os-release" || \ @@ -882,9 +882,9 @@ get_distro() { # Format the distro name. case "$distro_shorthand" in - "on") distro="${NAME:-${DISTRIB_ID}} ${VERSION_ID:-${DISTRIB_RELEASE}}" ;; + "on") distro="${NAME:-${DISTRIB_ID}} ${VERSION_ID:-${DISTRIB_RELEASE}}" ;; "tiny") distro="${NAME:-${DISTRIB_ID:-${TAILS_PRODUCT_NAME}}}" ;; - "off") distro="${PRETTY_NAME:-${DISTRIB_DESCRIPTION}} ${UBUNTU_CODENAME}" ;; + "off") distro="${PRETTY_NAME:-${DISTRIB_DESCRIPTION}} ${UBUNTU_CODENAME}" ;; esac # Workarounds for distros that go against the os-release standard. @@ -1039,7 +1039,7 @@ get_model() { ;; "Mac OS X") - if [[ "$(kextstat | grep "FakeSMC")" != "" ]]; then + if [[ "$(kextstat | grep -F "FakeSMC")" != "" ]]; then model="Hackintosh (SMBIOS: $(sysctl -n hw.model))" else model="$(sysctl -n hw.model)" From 4b684c0eb644eea3489e329bcfcd543bd0f72da4 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Thu, 31 May 2018 19:28:46 +1000 Subject: [PATCH 08/82] term_font: cleanup konsole --- neofetch | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/neofetch b/neofetch index ce1743d3..9d9d31c6 100755 --- a/neofetch +++ b/neofetch @@ -2874,13 +2874,14 @@ END # Get Process ID of current konsole window / tab child="$(get_ppid "$$")" - konsole_instances=($(qdbus | grep 'org.kde.konsole')) + IFS=$'\n' read -d "" -ra konsole_instances < <(qdbus | grep -F 'org.kde.konsole') for i in "${konsole_instances[@]}"; do - konsole_sessions=($(qdbus "${i}" | grep '/Sessions/')) + IFS=$'\n' read -d "" -ra konsole_sessions < <(qdbus "$i" | grep -F '/Sessions/') + for session in "${konsole_sessions[@]}"; do - if ((child == "$(qdbus "${i}" "${session}" processId)")); then - profile="$(qdbus "${i}" "${session}" environment |\ + if ((child == "$(qdbus "$i" "$session" processId)")); then + profile="$(qdbus "$i" "$session" environment |\ awk -F '=' '/KONSOLE_PROFILE_NAME/ {print $2}')" break fi @@ -2889,8 +2890,9 @@ END done # We could have two profile files for the same profile name, take first match - profile_filename="$(grep -l "Name=${profile}" "${HOME}"/.local/share/konsole/*.profile)" + profile_filename="$(grep -l "Name=${profile}" "$HOME"/.local/share/konsole/*.profile)" profile_filename="${profile_filename/$'\n'*}" + [[ "$profile_filename" ]] && \ term_font="$(awk -F '=|,' '/Font=/ {print $2 " " $3}' "$profile_filename")" ;; From da97fc8a6493f552cceefd72cb4cedf71fa60334 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Thu, 31 May 2018 19:35:29 +1000 Subject: [PATCH 09/82] term_font: cleanup xfce4-terminal --- neofetch | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/neofetch b/neofetch index 9d9d31c6..7110fb6f 100755 --- a/neofetch +++ b/neofetch @@ -3034,13 +3034,13 @@ END ;; "xfce4-terminal") - term_font="$(awk -F '=' '/^FontName/ {a=$2} /^FontUseSystem=TRUE/ {a=$0} END{print a}' \ + term_font="$(awk -F '=' '/^FontName/{a=$2}/^FontUseSystem=TRUE/{a=$0}END{print a}' \ "${XDG_CONFIG_HOME}/xfce4/terminal/terminalrc")" - if [[ "$term_font" == "FontUseSystem=TRUE" ]]; then + [[ "$term_font" == "FontUseSystem=TRUE" ]] && \ term_font="$(gsettings get org.gnome.desktop.interface monospace-font-name)" - term_font="$(trim_quotes "$term_font")" - fi + + term_font="$(trim_quotes "$term_font")" # Default fallback font hardcoded in terminal-preferences.c [[ -z "$term_font" ]] && term_font="Monospace 12" From 226f746c603c8096b17f48555a5637c458fe16e3 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Thu, 31 May 2018 19:48:14 +1000 Subject: [PATCH 10/82] term_font: cleanup urxvt/xterm --- neofetch | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/neofetch b/neofetch index 7110fb6f..9e368093 100755 --- a/neofetch +++ b/neofetch @@ -3010,16 +3010,15 @@ END term_font="${term_font/*"*.font:"}" term_font="$(trim "$term_font")" - if [[ -z "$term_font" && "$term" == "xterm" ]]; then + [[ -z "$term_font" && "$term" == "xterm" ]] && \ term_font="$(grep -E '^XTerm.vt100.faceName' <<< "$xrdb")" - term_font="${term_font/*"faceName:"}" - fi + + term_font="$(trim "${term_font/*"faceName:"}")" # xft: isn't required at the beginning so we prepend it if it's missing - if [[ "${term_font:0:1}" != "-" && \ - "${term_font:0:4}" != "xft:" ]]; then + [[ "${term_font:0:1}" != "-" && \ + "${term_font:0:4}" != "xft:" ]] && \ term_font="xft:$term_font" - fi # Xresources has two different font formats, this checks which # one is in use and formats it accordingly. @@ -3029,7 +3028,9 @@ END term_font="${term_font/:*}" ;; - "-"*) term_font="$(awk -F '\\-' '{printf $3}' <<< "$term_font")" ;; + "-"*) + IFS=- read -r _ _ term_font _ <<< "$term_font" + ;; esac ;; From f8779be33349cdedc5f931e9f5c4f6e98c75e833 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Fri, 1 Jun 2018 09:29:51 +1000 Subject: [PATCH 11/82] disk: cleanup --- neofetch | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/neofetch b/neofetch index 9e368093..4fda7dbc 100755 --- a/neofetch +++ b/neofetch @@ -3053,15 +3053,17 @@ get_disk() { type -p df >/dev/null 2>&1 ||\ { err "Disk requires 'df' to function. Install 'df' to get disk info."; return; } - # Get "df" version. df_version="$(df --version 2>&1)" + case "$df_version" in + *"IMitv"*) df_flags=(-P -g) ;; # AIX + *"befhikm"*) df_flags=(-P -k) ;; # IRIX + *"Tracker"*) # Haiku err "Your version of df cannot be used due to the non-standard flags" return ;; - *"IMitv"*) df_flags=(-P -g) ;; # AIX - *"befhikm"*) df_flags=(-P -k) ;; # IRIX + *) df_flags=(-P -h) ;; esac @@ -3071,10 +3073,10 @@ get_disk() { unset "disks[0]" # Stop here if 'df' fails to print disk info. - if [[ -z "${disks[*]}" ]]; then + [[ -z "${disks[*]}" ]] && { err "Disk: df failed to print the disks, make sure the disk_show array is set properly." return - fi + } for disk in "${disks[@]}"; do # Create a second array and make each element split at whitespace this time. @@ -3085,17 +3087,26 @@ get_disk() { *"befhikm"*) disk="$((disk_info[2]/1024/1024))G / $((disk_info[1]/1024/1024))G (${disk_perc}%)" ;; - *) disk="${disk_info[2]/i} / ${disk_info[1]/i} (${disk_perc}%)" ;; + + *) + disk="${disk_info[2]/i} / ${disk_info[1]/i} (${disk_perc}%)" + ;; esac # Subtitle. case "$disk_subtitle" in - "name") disk_sub="${disk_info[0]}" ;; + "name") + disk_sub="${disk_info[0]}" + ;; + "dir") disk_sub="${disk_info[5]/*\/}" - [[ -z "$disk_sub" ]] && disk_sub="${disk_info[5]}" + disk_sub="${disk_sub:-${disk_info[5]}}" + ;; + + *) + disk_sub="${disk_info[5]}" ;; - *) disk_sub="${disk_info[5]}" ;; esac # Bar. From f7001b142a9dbd1bd32425692f840a6b00534a20 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Fri, 1 Jun 2018 09:34:26 +1000 Subject: [PATCH 12/82] OS: Added support for PureOS --- neofetch | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/neofetch b/neofetch index 4fda7dbc..937aa168 100755 --- a/neofetch +++ b/neofetch @@ -7357,6 +7357,24 @@ ${c1} `-/osyyyysosyhhhhhyys+- EOF ;; + "PureOS"*) + set_colors 2 7 7 + read -rd '' ascii_data <<'EOF' +${c1}dmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmd +dNm//////////////////////////////////mNd +dNd dNd +dNd dNd +dNd dNd +dNd dNd +dNd dNd +dNd dNd +dNd dNd +dNd dNd +dNm//////////////////////////////////mNd +dmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmd +EOF + ;; + "Qubes"*) set_colors 4 5 7 6 read -rd '' ascii_data <<'EOF' From f143ed5991b52206d404187a05a4f1f227e46221 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Fri, 1 Jun 2018 09:54:46 +1000 Subject: [PATCH 13/82] OS: Added support for Kibojoe Linux --- neofetch | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/neofetch b/neofetch index 937aa168..ae49d6c6 100755 --- a/neofetch +++ b/neofetch @@ -6279,6 +6279,25 @@ ${c1} `..---+/---..` EOF ;; + "Kibojoe"*) + set_colors 2 7 4 + read -rd '' ascii_data <<'EOF' + ${c3} ./+oooooo+/. + -/+ooooo+/:.` + ${c1}`${c3}yyyo${c2}+++/++${c3}osss${c1}. + ${c1}+NMN${c3}yssssssssssss${c1}. + ${c1}.dMMMMN${c3}sssssssssssy${c1}Ns` + +MMMMMMMm${c3}sssssssssssh${c1}MNo` + `hMMMMMNNNMd${c3}sssssssssssd${c1}MMN/ + .${c3}syyyssssssy${c1}NNmmmmd${c3}sssss${c1}hMMMMd: + -NMmh${c3}yssssssssyhhhhyssyh${c1}mMMMMMMMy` + -NMMMMMNN${c3}mdhyyyyyyyhdm${c1}NMMMMMMMMMMMN+ +`NMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMd. +ods+/:-----://+oyydmNMMMMMMMMMMMMMMMMMN- +` .-:+osyhhdmmNNNmdo +EOF + ;; + "Kogaion"*) set_colors 4 7 1 read -rd '' ascii_data <<'EOF' From d7e04822d3b7d0e31fa15365c85b01d798e2509f Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Fri, 1 Jun 2018 10:04:04 +1000 Subject: [PATCH 14/82] OS: Added support for SharkLinux --- neofetch | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/neofetch b/neofetch index ae49d6c6..1a35e80c 100755 --- a/neofetch +++ b/neofetch @@ -7685,6 +7685,27 @@ M- ,=;;;#:, ,:#;;:=, ,@ EOF ;; + "SharkLinux"*) + set_colors 4 7 + read -rd '' ascii_data <<'EOF' +${c1} `:shd/ + `:yNMMMMs + `-smMMMMMMN. + .+dNMMMMMMMMs + .smNNMMMMMMMMm` + .sNNNNNNNMMMMMM/ + `omNNNNNNNMMMMMMm + /dNNNNNNNNMMMMMMM+ + .yNNNNNNNNNMMMMMMMN` + +mNNNNNNNNNMMMMMMMMh + .hNNNNNNNNNNMMMMMMMMMs + +mMNNNNNNNNMMMMMMMMMMMs + .hNMMNNNNMMMMMMMMMMMMMMMd + .oNNNNNNNNNNMMMMMMMMMMMMMMMo + `:+syyssoo++++ooooossssssssssso: +EOF + ;; + "Siduction"*) set_colors 4 4 read -rd '' ascii_data <<'EOF' From 5cac0a8dc196058ca90a56f4ddd9ff8cd456152c Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Fri, 1 Jun 2018 10:16:35 +1000 Subject: [PATCH 15/82] OS: Added support for Linux Lite --- neofetch | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/neofetch b/neofetch index 1a35e80c..8e5c99b2 100755 --- a/neofetch +++ b/neofetch @@ -6422,6 +6422,32 @@ ${c3} #####${c2}#######${c3}##### EOF ;; + "Linux Lite"*) + set_colors 2 7 + read -rd '' ascii_data <<'EOF' +${c1} ,xXc + .l0MMMMMO + .kNMMMMMWMMMN, + KMMMMMMKMMMMMMo + 'MMMMMMNKMMMMMM: + kMMMMMMOMMMMMMO + .MMMMMMX0MMMMMW. + oMMMMMMxWMMMMM: + WMMMMMNkMMMMMO +:MMMMMMOXMMMMW +.0MMMMMxMMMMM; +:;cKMMWxMMMMO +'MMWMMXOMMMMl + kMMMMKOMMMMMX: + .WMMMMKOWMMM0c + lMMMMMWO0MNd:' + oollXMKXoxl;. + ':. .: .' + .. + . +EOF + ;; + "LMDE"*) set_colors 2 7 read -rd '' ascii_data <<'EOF' From ffe94c26ee4b21f3439a2442d91cf699d285642c Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Fri, 1 Jun 2018 10:53:28 +1000 Subject: [PATCH 16/82] misc: cleanup --- neofetch | 51 +++++++++++++++++++++------------------------------ 1 file changed, 21 insertions(+), 30 deletions(-) diff --git a/neofetch b/neofetch index 8e5c99b2..4fd07493 100755 --- a/neofetch +++ b/neofetch @@ -3389,12 +3389,8 @@ get_cols() { # IMAGES image_backend() { - if [[ ! "$image_backend" =~ ^(off|ascii)$ ]]; then - if ! type -p convert >/dev/null 2>&1; then - image_backend="ascii" - err "Image: Imagemagick not found, falling back to ascii mode." - fi - fi + [[ "$image_backend" != "off" ]] && ! type -p convert >/dev/null 2>&1 && \ + { image_backend="ascii"; err "Image: Imagemagick not found, falling back to ascii mode."; } case "${image_backend:-off}" in "ascii") get_ascii ;; @@ -3404,26 +3400,22 @@ image_backend() { "tycat" | "w3m" | "sixel" | "pixterm" | "kitty") get_image_source - if [[ ! -f "$image" ]]; then + [[ ! -f "$image" ]] && { to_ascii "Image: '$image_source' doesn't exist, falling back to ascii mode." return - fi + } get_term_size - if [[ "$term_width" ]] && ((term_width >= 1)); then - printf "\e[2J\e[H" - else + ((term_width < 1)) && { to_ascii "Image: Failed to find terminal window size." err "Image: Check the 'Images in the terminal' wiki page for more info," return - fi + } + printf '\e[2J\e[H' get_image_size make_thumbnail - - [[ "$image_backend" == *"w3m"* ]] && zws="\xE2\x80\x8B\x20" - display_image ;; @@ -3514,17 +3506,14 @@ END "Windows") case "$distro" in "Windows XP") - case "$kernel_name" in - "CYGWIN"*) image="/cygdrive/c/Documents and Settings/${USER}" ;; - "MSYS2"* | "MINGW*") image="/c/Documents and Settings/${USER}" ;; - esac - image+="/Local Settings/Application Data/Microsoft" - image+="/Wallpaper1.bmp" + image="/c/Documents and Settings/${USER}" + image+="/Local Settings/Application Data/Microsoft/Wallpaper1.bmp" + + [[ "$kernel_name" == *CYGWIN* ]] && image="/cygdrive${image}" ;; "Windows"*) - image="$APPDATA/Microsoft/Windows/Themes" - image+="/TranscodedWallpaper.jpg" + image="${APPDATA}/Microsoft/Windows/Themes/TranscodedWallpaper.jpg" ;; esac ;; @@ -3533,13 +3522,14 @@ END # Get DE if user has disabled the function. ((de_run != 1)) && get_de - if type -p wal >/dev/null && [[ -f "${HOME}/.cache/wal/wal" ]]; then - image="$(< "${HOME}/.cache/wal/wal")" - return - fi + type -p wal >/dev/null && [[ -f "${HOME}/.cache/wal/wal" ]] && \ + { image="$(< "${HOME}/.cache/wal/wal")"; return; } case "$de" in - "MATE"*) image="$(gsettings get org.mate.background picture-filename)" ;; + "MATE"*) + image="$(gsettings get org.mate.background picture-filename)" + ;; + "Xfce"*) image="$(xfconf-query -c xfce4-desktop -p \ "/backdrop/screen0/monitor0/workspace0/last-image")" @@ -3843,6 +3833,7 @@ display_image() { "w3m") get_w3m_img_path + zws='\xE2\x80\x8B\x20' # Add a tiny delay to fix issues with images not # appearing in specific terminal emulators. @@ -3964,12 +3955,12 @@ get_line_break() { get_bold() { case "$ascii_bold" in - "on") ascii_bold="\e[1m" ;; + "on") ascii_bold="\e[1m" ;; "off") ascii_bold="" ;; esac case "$bold" in - "on") bold="\e[1m" ;; + "on") bold="\e[1m" ;; "off") bold="" ;; esac } From ae7271578afacd7964ff7b610dccd75c5190d68a Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Fri, 1 Jun 2018 12:34:28 +1000 Subject: [PATCH 17/82] image: Performance improvements --- neofetch | 88 ++++++++++++++++++++++++++++++-------------------------- 1 file changed, 48 insertions(+), 40 deletions(-) diff --git a/neofetch b/neofetch index 4fd07493..5a1da023 100755 --- a/neofetch +++ b/neofetch @@ -3594,22 +3594,20 @@ get_term_size() { # Tmux has a special way of reading escape sequences # so we have to use a slightly different sequence to # get the terminal size. - if [[ -n "$TMUX" ]]; then - printf "%b" "\ePtmux;\e\e[14t\e\e[c\e\\" - read_flags=(-d c) - - elif [[ "$image_backend" == "tycat" ]]; then - printf "%b" "\e}qs\000" + if [[ "$image_backend" == "tycat" ]]; then + printf '%b' '\e}qs\000' else - printf "%b" "\e[14t\e[c" - read_flags=(-d c) + case "${TMUX:-null}" in + "null") printf '%b' '\e[14t' ;; + *) printf '%b' '\ePtmux;\e\e[14t\e\\ ' ;; + esac fi # The escape codes above print the desired output as # user input so we have to use read to store the out # -put as a variable. - IFS=";" read -s -t 1 "${read_flags[@]}" -r -a term_size + IFS=';t' read -d t -t 0.05 -sra term_size # Split the string into height/width. if [[ "$image_backend" == "tycat" ]]; then @@ -3618,7 +3616,7 @@ get_term_size() { else term_height="${term_size[1]}" - term_width="${term_size[2]/t*}" + term_width="${term_size[2]}" fi [[ "$image_backend" == "kitty" ]] && \ @@ -3627,16 +3625,20 @@ get_term_size() { # Get terminal width/height if \e[14t is unsupported. if (( "${term_width:-0}" < 50 )) && [[ "$DISPLAY" && "$os" != "Mac OS X" ]]; then if type -p xdotool >/dev/null 2>&1; then - current_window="$(xdotool getactivewindow)" - source <(xdotool getwindowgeometry --shell "$current_window") - term_height="$HEIGHT" - term_width="$WIDTH" + IFS=$'\n' read -d "" -ra win < <(xdotool getactivewindow getwindowgeometry --shell %1) + term_width="${win[3]/WIDTH=}" + term_height="${win[4]/HEIGHT=}" elif type -p xwininfo >/dev/null 2>&1; then # Get the focused window's ID. - if type -p xdpyinfo >/dev/null 2>&1; then - current_window="$(xdpyinfo | grep -E -o "focus:.*0x[0-9a-f]+")" + if type -p xdo >/dev/null 2>&1; then + current_window="$(xdo id)" + + elif type -p xdpyinfo >/dev/null 2>&1; then + current_window="$(xdpyinfo | grep -F "focus:")" current_window="${current_window/*window }" + current_window="${current_window/,*}" + elif type -p xprop >/dev/null 2>&1; then current_window="$(xprop -root _NET_ACTIVE_WINDOW)" current_window="${current_window##* }" @@ -3644,10 +3646,11 @@ get_term_size() { # If the ID was found get the window size. if [[ "$current_window" ]]; then - term_size="$(xwininfo -id "$current_window" |\ - awk -F ': ' '/Width|Height/ {printf $2 " "}')" - term_width="${term_size/ *}" - term_height="${term_size/${term_width}}" + term_size="$(xwininfo -id "$current_window")" + term_width="${term_size#*Width: }" + term_width="${term_width/$'\n'*}" + term_height="${term_size/*Height: }" + term_height="${term_height/$'\n'*}" fi fi fi @@ -3693,19 +3696,20 @@ get_image_size() { done ;; - *) image_size="${image_size/px}" ;; + *) + image_size="${image_size/px}" + ;; esac width="${width:-$image_size}" height="${height:-$image_size}" - text_padding="$((width / font_width + gap + xoffset/font_width))" } make_thumbnail() { # Name the thumbnail using variables so we can # use it later. - image_name="$crop_mode-$crop_offset-$width-$height-${image##*/}" + image_name="${crop_mode}-${crop_offset}-${width}-${height}-${image##*/}" # Handle file extensions. case "${image##*.}" in @@ -3717,13 +3721,12 @@ make_thumbnail() { # Create the thumbnail dir if it doesn't exist. mkdir -p "$thumbnail_dir" - # Check to see if the thumbnail exists before we do any cropping. - if [[ ! -f "$thumbnail_dir/$image_name" ]]; then + if [[ ! -f "${thumbnail_dir}/${image_name}" ]]; then # Get image size so that we can do a better crop. - if [[ -z "$size" ]]; then + [[ -z "$size" ]] && { read -r og_width og_height <<< "$(identify -format "%w %h" "$image")" ((og_height > og_width)) && size="$og_width" || size="$og_height" - fi + } case "$crop_mode" in "fit") @@ -3737,9 +3740,9 @@ make_thumbnail() { -trim +repage \ -gravity south \ -background "$c" \ - -extent "$size"x"$size" \ - -scale "$width"x"$height" \ - "$thumbnail_dir/$image_name" + -extent "${size}x${size}" \ + -scale "${width}x${height}" \ + "${thumbnail_dir}/${image_name}" ;; "fill") @@ -3747,27 +3750,32 @@ make_thumbnail() { -background none \ "$image" \ -trim +repage \ - -scale "$width"x"$height"^ \ - -extent "$width"x"$height" \ - "$thumbnail_dir/$image_name" + -scale "${width}x${height}^" \ + -extent "${width}x${height}" \ + "${thumbnail_dir}/${image_name}" + ;; + + "none") + cp "$image" "${thumbnail_dir}/${image_name}" ;; - "none") cp "$image" "$thumbnail_dir/$image_name" ;; *) - convert \ + time convert \ -background none \ "$image" \ + -strip \ + -define "jpeg:size=100x100" \ -gravity "$crop_offset" \ - -crop "$size"x"$size"+0+0 \ - -quality 95 \ - -scale "$width"x"$height" \ - "$thumbnail_dir/$image_name" + -crop "${size}x${size}+0+0" \ + -quality 40 \ + -sample "${width}x${height}" \ + "${thumbnail_dir}/${image_name}" ;; esac fi # The final image. - image="$thumbnail_dir/$image_name" + image="${thumbnail_dir}/${image_name}" } display_image() { From 5e78bcb7befb8e9567958b3cec7553e367c788d4 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Fri, 1 Jun 2018 12:47:18 +1000 Subject: [PATCH 18/82] misc: Shorter syntax for no output --- neofetch | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/neofetch b/neofetch index 5a1da023..bb43c690 100755 --- a/neofetch +++ b/neofetch @@ -2449,7 +2449,7 @@ get_song() { /string "title"/ {getline; t=$2} END{print a " \n " b " \n " t}')" ;; - *) mpc >/dev/null 2>&1 && song="$(mpc -f '%artist% \n %album% \n %title%' current)" ;; + *) mpc &>/dev/null && song="$(mpc -f '%artist% \n %album% \n %title%' current)" ;; esac [[ "$song" != *[a-z]* ]] && { unset -v song; return; } @@ -3050,7 +3050,7 @@ END } get_disk() { - type -p df >/dev/null 2>&1 ||\ + type -p df &>/dev/null ||\ { err "Disk requires 'df' to function. Install 'df' to get disk info."; return; } df_version="$(df --version 2>&1)" @@ -3389,7 +3389,7 @@ get_cols() { # IMAGES image_backend() { - [[ "$image_backend" != "off" ]] && ! type -p convert >/dev/null 2>&1 && \ + [[ "$image_backend" != "off" ]] && ! type -p convert &>/dev/null && \ { image_backend="ascii"; err "Image: Imagemagick not found, falling back to ascii mode."; } case "${image_backend:-off}" in @@ -3624,22 +3624,22 @@ get_term_size() { # Get terminal width/height if \e[14t is unsupported. if (( "${term_width:-0}" < 50 )) && [[ "$DISPLAY" && "$os" != "Mac OS X" ]]; then - if type -p xdotool >/dev/null 2>&1; then + if type -p xdotool &>/dev/null; then IFS=$'\n' read -d "" -ra win < <(xdotool getactivewindow getwindowgeometry --shell %1) term_width="${win[3]/WIDTH=}" term_height="${win[4]/HEIGHT=}" - elif type -p xwininfo >/dev/null 2>&1; then + elif type -p xwininfo &>/dev/null; then # Get the focused window's ID. - if type -p xdo >/dev/null 2>&1; then + if type -p xdo &>/dev/null; then current_window="$(xdo id)" - elif type -p xdpyinfo >/dev/null 2>&1; then + elif type -p xdpyinfo &>/dev/null; then current_window="$(xdpyinfo | grep -F "focus:")" current_window="${current_window/*window }" current_window="${current_window/,*}" - elif type -p xprop >/dev/null 2>&1; then + elif type -p xprop &>/dev/null; then current_window="$(xprop -root _NET_ACTIVE_WINDOW)" current_window="${current_window##* }" fi @@ -3847,7 +3847,7 @@ display_image() { # appearing in specific terminal emulators. sleep 0.05 printf "%b\n" "0;1;$xoffset;$yoffset;$width;$height;;;;;$image\n4;\n3;" |\ - "${w3m_img_path:-false}" -bg "$background_color" >/dev/null 2>&1 ||\ + "${w3m_img_path:-false}" -bg "$background_color" &>/dev/null ||\ to_off "Image: w3m-img failed to display the image." ;; esac @@ -4173,13 +4173,13 @@ kde_config_dir() { if [[ "$kde_config_dir" ]]; then return - elif type -p kf5-config >/dev/null 2>&1; then + elif type -p kf5-config &>/dev/null; then kde_config_dir="$(kf5-config --path config)" - elif type -p kde4-config >/dev/null 2>&1; then + elif type -p kde4-config &>/dev/null; then kde_config_dir="$(kde4-config --path config)" - elif type -p kde-config >/dev/null 2>&1; then + elif type -p kde-config &>/dev/null; then kde_config_dir="$(kde-config --path config)" elif [[ -d "${HOME}/.kde4" ]]; then From 1f7aa76c48ea74c134bf0f0d67381570de35c913 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Fri, 1 Jun 2018 12:54:31 +1000 Subject: [PATCH 19/82] misc: cleanup --- neofetch | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/neofetch b/neofetch index bb43c690..cf9e80cf 100755 --- a/neofetch +++ b/neofetch @@ -4085,11 +4085,11 @@ get_full_path() { # If the file exists in the current directory, stop here. [[ -f "${PWD}/${1/*\/}" ]] && { printf "%s\n" "${PWD}/${1/*\/}"; return; } - if ! cd "${1%/*}"; then + ! cd "${1%/*}" && { err "Error: Directory '${1%/*}' doesn't exist or is inaccessible" err " Check that the directory exists or try another directory." exit 1 - fi + } local full_dir="${1##*/}" @@ -4108,11 +4108,11 @@ get_full_path() { get_user_config() { # Check $config_file. - if [[ -f "$config_file" ]]; then + [[ -f "$config_file" ]] && { source "$config_file" err "Config: Sourced user config. (${config_file})" return - fi + } mkdir -p "${XDG_CONFIG_HOME}/neofetch/" # Check ${XDG_CONFIG_HOME}/neofetch and create the From c1f0fc969991fede65dbad1cd498555c7f31099f Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Fri, 1 Jun 2018 12:58:23 +1000 Subject: [PATCH 20/82] misc: fix some lint errors --- neofetch | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/neofetch b/neofetch index cf9e80cf..16ef1a8b 100755 --- a/neofetch +++ b/neofetch @@ -803,8 +803,8 @@ get_os() { ;; *) - printf "%s\n" "Unknown OS detected: '$kernel_name', aborting..." >&2 - printf "%s\n" "Open an issue on GitHub to add support for your OS." >&2 + printf '%s\n' "Unknown OS detected: '$kernel_name', aborting..." >&2 + printf '%s\n' "Open an issue on GitHub to add support for your OS." >&2 exit 1 ;; esac @@ -2366,7 +2366,7 @@ get_song() { case "${player/*\/}" in "mpd"* | "mopidy"*) song="$(mpc -f '%artist% \n %album% \n %title%' current)" ;; - "mocp"*) song="$(mocp -Q "%artist \n %album \n %song")" ;; + "mocp"*) song="$(mocp -Q '%artist \n %album \n %song')" ;; "google play"*) song="$(gpmdp-remote current)" ;; "rhythmbox"*) song="$(rhythmbox-client --print-playing-format '%ta \n %at \n %tt')" ;; "deadbeef"*) song="$(deadbeef --nowplaying-tf '%artist% \n %album% \n %title%')" ;; @@ -3909,7 +3909,7 @@ info() { prin() { # If $2 doesn't exist we format $1 as info. if [[ "$(trim "$1")" && "$2" ]]; then - [[ "$json" ]] && { printf " %s\n" "\"${1}\": \"${2}\","; return; } + [[ "$json" ]] && { printf ' %s\n' "\"${1}\": \"${2}\","; return; } string="${1}${2:+: $2}" else @@ -3977,7 +3977,7 @@ trim() { set -f # shellcheck disable=2048,2086 set -- $* - printf "%s\\n" "${*//[[:space:]]/ }" + printf '%s\n' "${*//[[:space:]]/ }" set +f } @@ -3993,7 +3993,7 @@ strip_sequences() { strip="${strip//$'\e['38\;5\;[0-9][0-9]m}" strip="${strip//$'\e['38\;5\;[0-9][0-9][0-9]m}" - printf "%s\n" "$strip" + printf '%s\n' "$strip" } # COLORS @@ -4083,7 +4083,7 @@ get_full_path() { # For example "Pictures/Wallpapers" --> "/home/dylan/Pictures/Wallpapers" # If the file exists in the current directory, stop here. - [[ -f "${PWD}/${1/*\/}" ]] && { printf "%s\n" "${PWD}/${1/*\/}"; return; } + [[ -f "${PWD}/${1/*\/}" ]] && { printf '%s\n' "${PWD}/${1/*\/}"; return; } ! cd "${1%/*}" && { err "Error: Directory '${1%/*}' doesn't exist or is inaccessible" @@ -4103,7 +4103,7 @@ get_full_path() { # Final directory. full_dir="$(pwd -P)/${1/*\/}" - [[ -e "$full_dir" ]] && printf "%s\n" "$full_dir" + [[ -e "$full_dir" ]] && printf '%s\n' "$full_dir" } get_user_config() { @@ -4127,7 +4127,7 @@ get_user_config() { config_file="${XDG_CONFIG_HOME}/neofetch/config.conf" # The config file doesn't exist, create it. - printf "%s\n" "$config" > "$config_file" + printf '%s\n' "$config" > "$config_file" fi source "$config_file" @@ -4702,11 +4702,11 @@ get_args() { ;; "--stdout") stdout="on" ;; "-v") verbose="on" ;; - "--print_config") printf "%s\\n" "$config"; exit ;; + "--print_config") printf '%s\n' "$config"; exit ;; "-vv") set -x; verbose="on" ;; "--help") usage ;; "--version") - printf "%s\\n" "Neofetch $version" + printf '%s\n' "Neofetch $version" exit 1 ;; "--gen-man") @@ -4719,10 +4719,10 @@ get_args() { json="on" unset -f get_title get_cols get_line_break get_underline - printf "{\n" + printf '{\n' print_info 2>/dev/null - printf " %s\n" "\"Version\": \"${version}\"" - printf "}\n" + printf ' %s\n' "\"Version\": \"${version}\"" + printf '}\n' exit ;; From bd5706ca0e574e7cd92c2367b9ff96a3c2c9237e Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Fri, 1 Jun 2018 13:03:53 +1000 Subject: [PATCH 21/82] misc: remove unused var --- neofetch | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/neofetch b/neofetch index 16ef1a8b..f9b0cd85 100755 --- a/neofetch +++ b/neofetch @@ -32,7 +32,7 @@ bash_version="${BASH_VERSION/.*}" sys_locale="${LANG:-C}" XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-${HOME}/.config}" PATH="/usr/xpg4/bin:/usr/sbin:/sbin:/usr/etc:/usr/libexec:${PATH}" -reset="\e[0m" +reset='\e[0m' shopt -s nocasematch # Speed up script by not using unicode. @@ -1727,7 +1727,7 @@ get_wm_theme() { path="$(wmic process get ExecutablePath | grep -F "blackbox")" path="${path//\\/\/}" - wm_theme="$(grep "^session\.styleFile:" "${path/\.exe/.rc}")" + wm_theme="$(grep '^session\.styleFile:' "${path/\.exe/.rc}")" wm_theme="${wm_theme/'session.styleFile: '}" wm_theme="${wm_theme##*\\}" wm_theme="${wm_theme%.*}" @@ -2790,7 +2790,7 @@ END # dow" though, but that does not match to a guid in the plist. # So, be warned, collisions may occur! # See: https://groups.google.com/forum/#!topic/iterm2-discuss/0tO3xZ4Zlwg - local current_profile_name profiles_count profile_name diff_font none_ascii + local current_profile_name profiles_count profile_name diff_font current_profile_name="$(osascript < Date: Fri, 1 Jun 2018 13:22:31 +1000 Subject: [PATCH 22/82] misc: cleanup --- neofetch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/neofetch b/neofetch index f9b0cd85..ae8fd6de 100755 --- a/neofetch +++ b/neofetch @@ -3004,14 +3004,14 @@ END "urxvt" | "urxvtd" | "rxvt-unicode" | "xterm") xrdb="$(xrdb -query)" - term_font="$(grep -i "${term/d}\**\.*font" <<< "$xrdb")" + term_font="$(grep -i "${term/d}"'\**\.*font' <<< "$xrdb")" term_font="${term_font/*"*font:"}" term_font="${term_font/*".font:"}" term_font="${term_font/*"*.font:"}" term_font="$(trim "$term_font")" [[ -z "$term_font" && "$term" == "xterm" ]] && \ - term_font="$(grep -E '^XTerm.vt100.faceName' <<< "$xrdb")" + term_font="$(grep '^XTerm.vt100.faceName' <<< "$xrdb")" term_font="$(trim "${term_font/*"faceName:"}")" From aab70da27c097389c6df92a99525100b27655877 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 1 Jun 2018 14:02:12 +0200 Subject: [PATCH 23/82] song: add gmusicbrowser --- neofetch | 3 +++ 1 file changed, 3 insertions(+) diff --git a/neofetch b/neofetch index ae8fd6de..5b51aeef 100755 --- a/neofetch +++ b/neofetch @@ -410,6 +410,7 @@ disk_subtitle="mount" # elisa # exaile # gnome-music +# gmusicbrowser # Google Play # guayadeque # iTunes @@ -2324,6 +2325,7 @@ get_song() { "elise" "exaile" "gnome-music" + "gmusicbrowser" "Google Play" "guayadeque" "iTunes" @@ -2385,6 +2387,7 @@ get_song() { "sayonara"*) get_song_dbus "sayonara" ;; "audacious"*) get_song_dbus "audacious" ;; "vlc"*) get_song_dbus "vlc" ;; + "gmusicbrowser"*) get_song_dbus "gmusicbrowser" ;; "cmus"*) song="$(cmus-remote -Q | awk 'BEGIN { ORS=" "}; From 840d4afbb1dc35f5dcda8395b8bcdec504c39cee Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Fri, 1 Jun 2018 14:10:11 +0200 Subject: [PATCH 24/82] misc: align some lines --- neofetch | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/neofetch b/neofetch index 5b51aeef..53cb4c08 100755 --- a/neofetch +++ b/neofetch @@ -2368,25 +2368,25 @@ get_song() { case "${player/*\/}" in "mpd"* | "mopidy"*) song="$(mpc -f '%artist% \n %album% \n %title%' current)" ;; - "mocp"*) song="$(mocp -Q '%artist \n %album \n %song')" ;; - "google play"*) song="$(gpmdp-remote current)" ;; - "rhythmbox"*) song="$(rhythmbox-client --print-playing-format '%ta \n %at \n %tt')" ;; - "deadbeef"*) song="$(deadbeef --nowplaying-tf '%artist% \n %album% \n %title%')" ;; - "xmms2d"*) song="$(xmms2 current -f '${artist} \n ${album} \n ${title}')" ;; - "qmmp"*) song="$(qmmp --nowplaying '%p \n %a \n %t')" ;; - "gnome-music"*) get_song_dbus "GnomeMusic" ;; - "lollypop"*) get_song_dbus "Lollypop" ;; - "clementine"*) get_song_dbus "clementine" ;; - "juk"*) get_song_dbus "juk" ;; - "bluemindo"*) get_song_dbus "Bluemindo" ;; - "guayadeque"*) get_song_dbus "guayadeque" ;; - "yarock"*) get_song_dbus "yarock" ;; - "deepin-music"*) get_song_dbus "DeepinMusic" ;; - "tomahawk"*) get_song_dbus "tomahawk" ;; - "elisa"*) get_song_dbus "elisa" ;; - "sayonara"*) get_song_dbus "sayonara" ;; - "audacious"*) get_song_dbus "audacious" ;; - "vlc"*) get_song_dbus "vlc" ;; + "mocp"*) song="$(mocp -Q '%artist \n %album \n %song')" ;; + "google play"*) song="$(gpmdp-remote current)" ;; + "rhythmbox"*) song="$(rhythmbox-client --print-playing-format '%ta \n %at \n %tt')" ;; + "deadbeef"*) song="$(deadbeef --nowplaying-tf '%artist% \n %album% \n %title%')" ;; + "xmms2d"*) song="$(xmms2 current -f '${artist} \n ${album} \n ${title}')" ;; + "qmmp"*) song="$(qmmp --nowplaying '%p \n %a \n %t')" ;; + "gnome-music"*) get_song_dbus "GnomeMusic" ;; + "lollypop"*) get_song_dbus "Lollypop" ;; + "clementine"*) get_song_dbus "clementine" ;; + "juk"*) get_song_dbus "juk" ;; + "bluemindo"*) get_song_dbus "Bluemindo" ;; + "guayadeque"*) get_song_dbus "guayadeque" ;; + "yarock"*) get_song_dbus "yarock" ;; + "deepin-music"*) get_song_dbus "DeepinMusic" ;; + "tomahawk"*) get_song_dbus "tomahawk" ;; + "elisa"*) get_song_dbus "elisa" ;; + "sayonara"*) get_song_dbus "sayonara" ;; + "audacious"*) get_song_dbus "audacious" ;; + "vlc"*) get_song_dbus "vlc" ;; "gmusicbrowser"*) get_song_dbus "gmusicbrowser" ;; "cmus"*) From 96386dc90ecc1e00305269bffd49b2fd65cb581d Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 2 Jun 2018 09:52:49 +1000 Subject: [PATCH 25/82] cols: Fix lint errors. --- neofetch | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/neofetch b/neofetch index ae8fd6de..da1cf02a 100755 --- a/neofetch +++ b/neofetch @@ -3345,16 +3345,18 @@ get_cols() { # Convert the width to space chars. printf -v block_width "%${block_width}s" - # Set variables. - start="${block_range[0]}" - end="${block_range[1]}" - # Generate the string. - for ((start; start<=end; start++)); do - case "$start" in - [0-6]) blocks+="${reset}\e[3${start}m\e[4${start}m${block_width}" ;; - 7) blocks+="${reset}\e[3${start}m\e[4${start}m${block_width}" ;; - *) blocks2+="\e[38;5;${start}m\e[48;5;${start}m${block_width}" ;; + for ((block_range[0]; block_range[0]<=block_range[1]; block_range[0]++)); do + case "${block_range[0]}" in + [0-7]) + printf -v blocks '%b\e[3%bm\e[4%bm%b' \ + "$blocks" "${block_range[0]}" "${block_range[0]}" "$block_width" + ;; + + *) + printf -v blocks2 '%b\e[38;5;%bm\e[48;5;%bm%b' \ + "$blocks2" "${block_range[0]}" "${block_range[0]}" "$block_width" + ;; esac done @@ -3372,7 +3374,7 @@ get_cols() { # Add block height to info height. ((info_height+=block_height-1)) - printf "%b" "\e[${text_padding}C${zws}${cols}" + printf '\e[%bC%b' "$text_padding" "${zws}${cols}" fi unset -v blocks blocks2 cols From c1cde629c44c7c1876a069d9e8f51d20ceb86e9a Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 2 Jun 2018 10:07:04 +1000 Subject: [PATCH 26/82] resolution: Fix lint error. --- neofetch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/neofetch b/neofetch index 98565843..bcc4db88 100755 --- a/neofetch +++ b/neofetch @@ -2529,8 +2529,8 @@ get_resolution() { case "$refresh_rate" in "on") resolution="$(xrandr --nograb --current |\ - awk 'match($0,/[0-9]*\.[0-9]*\*/) {printf $1 " @ "\ - substr($0,RSTART,RLENGTH) "Hz, "}')" + awk 'match($0,/[0-9]*\.[0-9]*\*/) { + printf $1 " @ " substr($0,RSTART,RLENGTH) "Hz, "}')" ;; "off") From 6ea186d9878c3a0c9e8f23370ee8ddc052f7c9ca Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 2 Jun 2018 12:08:08 +1000 Subject: [PATCH 27/82] misc: Fix lint errors. --- neofetch | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/neofetch b/neofetch index bcc4db88..b53246f9 100755 --- a/neofetch +++ b/neofetch @@ -3384,8 +3384,7 @@ get_cols() { # TosWin2 on FreeMiNT is terrible at this, # so we'll reset colors arbitrarily. - [[ "$term" == "TosWin2" ]] && \ - printf "%b" "\e[30;47m" + [[ "$term" == "TosWin2" ]] && printf '\e[30;47m' # Tell info() that we printed manually. prin=1 @@ -3434,7 +3433,7 @@ image_backend() { esac # Set cursor position next image/ascii. - [[ "$image_backend" != "off" ]] && printf "%b" "\e[${lines:-0}A\e[9999999D" + [[ "$image_backend" != "off" ]] && printf '\e[%sA\e[9999999D' "${lines:-0}" } get_ascii() { @@ -3449,8 +3448,8 @@ get_ascii() { # Turn file into variable. while IFS=$'\n' read -r line; do - print+="$line \n" - + print+="$line +" # Calculate size of ascii file in line length / line count. line="${line//[??;?;??m}" line="${line//[??;?;???m}" @@ -3831,12 +3830,14 @@ display_image() { "iterm2") image="$(base64 < "$image")" - iterm_cmd="\e]1337;File=width=${width}px;height=${height}px;inline=1:${image}" + + printf -v iterm_cmd '\e]1337;File=width=%spx;height=%spx;inline=1:%s' \ + "$width" "$height" "$image" # Tmux requires an additional escape sequence for this to work. - [[ -n "$TMUX" ]] && iterm_cmd="\ePtmux;\e${iterm_cmd}\e\\" + [[ -n "$TMUX" ]] && printf -v iterm_cmd '\ePtmux;\e%b\e'\\ "$iterm_cmd" - printf "%b\a\n" "$iterm_cmd" + printf '%b\a\n' "$iterm_cmd" ;; "tycat") @@ -3851,7 +3852,7 @@ display_image() { # Add a tiny delay to fix issues with images not # appearing in specific terminal emulators. sleep 0.05 - printf "%b\n" "0;1;$xoffset;$yoffset;$width;$height;;;;;$image\n4;\n3;" |\ + printf '%b\n%s;\n%s\n' "0;1;$xoffset;$yoffset;$width;$height;;;;;$image" 3 4 |\ "${w3m_img_path:-false}" -bg "$background_color" &>/dev/null ||\ to_off "Image: w3m-img failed to display the image." ;; @@ -3869,7 +3870,7 @@ to_ascii() { get_ascii # Set cursor position next image/ascii. - printf "%b" "\e[${lines:-0}A\e[9999999D" + printf '\e[%sA\e[9999999D' "${lines:-0}" } to_off() { @@ -3934,7 +3935,7 @@ prin() { string="${subtitle_color}${bold}${string}" # Print the info. - printf "%b\n" "${text_padding:+\e[${text_padding}C}${zws}${string}${reset} " + printf '%b\n' "${text_padding:+\e[${text_padding}C}${zws}${string}${reset} " # Calculate info height. ((++info_height)) @@ -3946,7 +3947,7 @@ prin() { get_underline() { if [[ "$underline_enabled" == "on" ]]; then printf -v underline "%${length}s" - printf "%b%b\n" "${text_padding:+\e[${text_padding}C}${zws}${underline_color}" \ + printf '%b%b\n' "${text_padding:+\e[${text_padding}C}${zws}${underline_color}" \ "${underline// /$underline_char}${reset} " unset -v length fi @@ -3957,7 +3958,7 @@ get_underline() { get_line_break() { # Print it directly. - printf "%b\n" "${zws}" + printf '%b\n' "$zws" # Calculate info height. ((++info_height)) @@ -3968,12 +3969,12 @@ get_line_break() { get_bold() { case "$ascii_bold" in - "on") ascii_bold="\e[1m" ;; + "on") ascii_bold='\e[1m' ;; "off") ascii_bold="" ;; esac case "$bold" in - "on") bold="\e[1m" ;; + "on") bold='\e[1m' ;; "off") bold="" ;; esac } @@ -4055,9 +4056,9 @@ set_text_colors() { color() { case "$1" in - [0-6]) printf "%b" "${reset}\e[3${1}m" ;; - 7 | "fg") printf "%b" "\e[37m${reset}" ;; - *) printf "%b" "\e[38;5;${1}m" ;; + [0-6]) printf '%b\e[3%sm' "$reset" "$1" ;; + 7 | "fg") printf '\e[37m%b' "$reset" ;; + *) printf '\e[38;5;%bm' "$1" ;; esac } @@ -4080,7 +4081,8 @@ stdout() { } err() { - err+="$(color 1)[!]\e[0m $1\n" + err+="$(color 1)[!]${reset} $1 +" } get_full_path() { @@ -4198,7 +4200,7 @@ kde_config_dir() { } dynamic_prompt() { - [[ "$image_backend" == "off" ]] && { printf "\n"; return; } + [[ "$image_backend" == "off" ]] && { printf '\n'; return; } [[ "$image_backend" != "ascii" ]] && lines="$(((height + yoffset) / font_height + 1))" # If the ascii art is taller than the info. @@ -8512,7 +8514,7 @@ main() { trap 'printf "\e[?25h\e[?7h"' EXIT # Hide the cursor and disable line wrap. - printf "\e[?25l\e[?7l" + printf '\e[?25l\e[?7l' fi image_backend From 37bb79460239367e14cecf01f65b76e9ab917c89 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 2 Jun 2018 12:28:10 +1000 Subject: [PATCH 28/82] misc: fix awk lint errors --- neofetch | 90 +++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 66 insertions(+), 24 deletions(-) diff --git a/neofetch b/neofetch index b53246f9..ba130d9f 100755 --- a/neofetch +++ b/neofetch @@ -1682,15 +1682,25 @@ get_wm_theme() { kdebugrc="${kde_config_dir}/kdebugrc" if [[ -f "$kwinrc" ]]; then - wm_theme="$(awk '/theme=/{gsub(/theme=.*qml_|theme=.*svg__/,"",$0);\ - print $0; exit}' "$kwinrc")" + wm_theme="$(awk '/theme=/ { + gsub(/theme=.*qml_|theme=.*svg__/,"",$0); + print $0; + exit + }' "$kwinrc")" [[ -z "$wm_theme" ]] && \ - wm_theme="$(awk '/library=org.kde/{gsub(/library=org.kde./,"",$0);\ - print $0; exit}' "$kwinrc")" + wm_theme="$(awk '/library=org.kde/ { + gsub(/library=org.kde./,"",$0); + print $0; + exit + }' "$kwinrc")" + [[ -z "$wm_theme" ]] && \ - wm_theme="$(awk '/PluginLib=kwin3_/{gsub(/PluginLib=kwin3_/,"",$0);\ - print $0; exit}' "$kwinrc")" + wm_theme="$(awk '/PluginLib=kwin3_/ { + gsub(/PluginLib=kwin3_/,"",$0); + print $0; + exit + }' "$kwinrc")" elif [[ -f "$kdebugrc" ]]; then wm_theme="$(awk '/(decoration)/ {gsub(/\[/,"",$1); print $1; exit}' "$kdebugrc")" @@ -1764,8 +1774,10 @@ get_cpu() { ;; *) - cpu="$(awk -F ': | @' '/model name|Processor|^cpu model|chip type|^cpu type/\ - {printf $2; exit}' "$cpu_file")" + cpu="$(awk -F ': | @' '/model name|Processor|^cpu model|chip type|^cpu type/ { + printf $2; + exit + }' "$cpu_file")" [[ "$cpu" == *"processor rev"* ]] && \ cpu="$(awk -F':' '/Hardware/ {print $2; exit}' "$cpu_file")" @@ -2391,9 +2403,15 @@ get_song() { "cmus"*) song="$(cmus-remote -Q | awk 'BEGIN { ORS=" "}; - /tag artist/ {$1=$2=""; sub(" ", ""); a=$0}\ - /tag album / {$1=$2=""; sub(" ", ""); b=$0}\ - /tag title/ {$1=$2=""; sub(" ", ""); t=$0}\ + /tag artist/ { + $1=$2=""; sub(" ", ""); a=$0 + } + /tag album / { + $1=$2=""; sub(" ", ""); b=$0 + } + /tag title/ { + $1=$2=""; sub(" ", ""); t=$0 + } END { print a " \n " b " \n " t }')" ;; @@ -2448,8 +2466,19 @@ get_song() { "pogo"*) song="$(dbus-send --print-reply --dest=org.mpris.pogo /Player \ org.freedesktop.MediaPlayer.GetMetadata | - awk -F'"' '/string "artist"/ {getline; a=$2} /string "album"/ {getline; b=$2} \ - /string "title"/ {getline; t=$2} END{print a " \n " b " \n " t}')" + awk -F'"' '/string "artist"/ { + getline; + a=$2 + } + /string "album"/ { + getline; + b=$2 + } + /string "title"/ { + getline; + t=$2 + } + END{print a " \n " b " \n " t}')" ;; *) mpc &>/dev/null && song="$(mpc -f '%artist% \n %album% \n %title%' current)" ;; @@ -2865,12 +2894,15 @@ END fi - term_font="$(awk '/^([[:space:]]*|[^#_])font_family[[:space:]]+/ \ - { $1 = ""; gsub(/^[[:space:]]/, ""); font = $0 } \ - /^([[:space:]]*|[^#_])font_size[[:space:]]+/ \ - { size = $2 } \ - END { print font " " size}' \ - "${kitty_file}")" + term_font="$(awk '/^([[:space:]]*|[^#_])font_family[[:space:]]+/ { + $1 = ""; + gsub(/^[[:space:]]/, ""); + font = $0 + } + /^([[:space:]]*|[^#_])font_size[[:space:]]+/ { + size = $2 + } + END { print font " " size}' "${kitty_file}")" ;; "konsole"*) @@ -2919,9 +2951,13 @@ END role="${role//\"}" profile="$(awk -F '=' -v r="$role" \ - '$0~r {getline; if(/Maximized/) getline; \ - if(/Fullscreen/) getline; id=$2"]"} \ - $0~id {if(id) {getline; print $2; exit}}' "$mateterm_config")" + '$0~r { + getline; + if(/Maximized/) getline; + if(/Fullscreen/) getline; + id=$2"]" + } $0~id {if(id) {getline; print $2; exit}}' \ + "$mateterm_config")" rm -f "$mateterm_config" @@ -3001,8 +3037,14 @@ END [[ -f "${XDG_CONFIG_HOME}/termite/config" ]] && \ termite_config="${XDG_CONFIG_HOME}/termite/config" - term_font="$(awk -F '= ' '/\[options\]/ {opt=1} /^\s*font/ {if(opt==1) a=$2; opt=0} \ - END{print a}' "/etc/xdg/termite/config" "$termite_config")" + term_font="$(awk -F '= ' '/\[options\]/ { + opt=1 + } + /^\s*font/ { + if(opt==1) a=$2; + opt=0 + } END{print a}' "/etc/xdg/termite/config" \ + "$termite_config")" ;; "urxvt" | "urxvtd" | "rxvt-unicode" | "xterm") From eba08e3efc29db47eb0a5ccd32f5f290a31d618b Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 2 Jun 2018 12:40:09 +1000 Subject: [PATCH 29/82] misc: fix more lint errors --- neofetch | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/neofetch b/neofetch index ba130d9f..71f89f26 100755 --- a/neofetch +++ b/neofetch @@ -1,5 +1,6 @@ #!/usr/bin/env bash # vim: noai:ts=4:sw=4:expandtab +# shellcheck source=/dev/null # # Neofetch: A command-line system information tool written in bash 3.2+. # https://github.com/dylanaraps/neofetch @@ -40,7 +41,7 @@ LC_ALL=C LANG=C # Fix issues with gsettings. -GIO_EXTRA_MODULES="/usr/lib/x86_64-linux-gnu/gio/modules/" +export GIO_EXTRA_MODULES="/usr/lib/x86_64-linux-gnu/gio/modules/" # Neofetch default config. read -rd '' config <<'EOF' @@ -3230,7 +3231,7 @@ get_battery() { "Windows") battery="$(wmic Path Win32_Battery get EstimatedChargeRemaining)" battery="${battery/EstimatedChargeRemaining}" - batttery="$(trim "$battery")%" + battery="$(trim "$battery")%" ;; "Haiku") @@ -3765,7 +3766,7 @@ make_thumbnail() { esac # Create the thumbnail dir if it doesn't exist. - mkdir -p "$thumbnail_dir" + mkdir -p "${thumbnail_dir:=${XDG_CACHE_HOME:-${HOME}/.cache}/thumbnails/neofetch}" if [[ ! -f "${thumbnail_dir}/${image_name}" ]]; then # Get image size so that we can do a better crop. @@ -4828,6 +4829,9 @@ get_args() { memory_display="infobar" disk_display="infobar" cpu_temp="C" + + # Known implicit unused variables. + printf '%s\n' "$kernel $icons $font $battery $locale" ;; esac From 55c128211ca70495e7886526769706bc5c477d7f Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 2 Jun 2018 12:43:48 +1000 Subject: [PATCH 30/82] misc: Fix more lint errors. --- neofetch | 1 + 1 file changed, 1 insertion(+) diff --git a/neofetch b/neofetch index 71f89f26..69a1fa5d 100755 --- a/neofetch +++ b/neofetch @@ -1,6 +1,7 @@ #!/usr/bin/env bash # vim: noai:ts=4:sw=4:expandtab # shellcheck source=/dev/null +# shellcheck disable=2016,2009 # # Neofetch: A command-line system information tool written in bash 3.2+. # https://github.com/dylanaraps/neofetch From 8d0205a56a72ab6cdfd9274df9bd3b1db3236052 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 2 Jun 2018 12:58:53 +1000 Subject: [PATCH 31/82] misc: Fix misc style error. --- neofetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neofetch b/neofetch index 69a1fa5d..c5141917 100755 --- a/neofetch +++ b/neofetch @@ -2958,7 +2958,7 @@ END if(/Maximized/) getline; if(/Fullscreen/) getline; id=$2"]" - } $0~id {if(id) {getline; print $2; exit}}' \ + } $0~id {if(id) {getline; print $2; exit}}' \ "$mateterm_config")" rm -f "$mateterm_config" From d02c590ff7ce1a9e15c178d243603cda6138e5d6 Mon Sep 17 00:00:00 2001 From: Andrew Titmuss Date: Sat, 2 Jun 2018 13:09:02 +1000 Subject: [PATCH 32/82] misc: fix most SC1117 errors from PlistBuddy --- neofetch | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/neofetch b/neofetch index c5141917..f3b401c0 100755 --- a/neofetch +++ b/neofetch @@ -2837,25 +2837,25 @@ END font_file="${HOME}/Library/Preferences/com.googlecode.iterm2.plist" # Count Guids in "New Bookmarks"; they should be unique - profiles_count="$(PlistBuddy -c "Print :New\ Bookmarks:" "$font_file" | \ + profiles_count="$(PlistBuddy -c "Print ':New Bookmarks:'" "$font_file" | \ grep -w -c "Guid")" for ((i=0; i Date: Sat, 2 Jun 2018 13:54:17 +1000 Subject: [PATCH 33/82] packages: cleanup --- neofetch | 3 --- 1 file changed, 3 deletions(-) diff --git a/neofetch b/neofetch index f3b401c0..86960457 100755 --- a/neofetch +++ b/neofetch @@ -1337,9 +1337,6 @@ get_packages() { ;; "Mac OS X" | "MINIX") - [[ -d "/usr/local/bin" ]] && \ - packages="$(($(ls -l /usr/local/bin/ | grep -cv "\(../Cellar/\|brew\)") - 1))" - type -p port >/dev/null && \ ((packages+=$(port installed | wc -l) - 1)) From 4bc2a23a463745172419374c3142875d2f373445 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 2 Jun 2018 14:44:52 +1000 Subject: [PATCH 34/82] packages: refactor --- neofetch | 170 ++++++++++++++++++++++------------------------------- neofetch.1 | 5 +- 2 files changed, 73 insertions(+), 102 deletions(-) diff --git a/neofetch b/neofetch index 86960457..1f291e85 100755 --- a/neofetch +++ b/neofetch @@ -144,6 +144,21 @@ os_arch="on" uptime_shorthand="on" +# Packages + + +# Show/Hide Package Manager names. +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --package_manager +# +# Example: +# on: '900 (pacman, apt)' +# off: '900' +package_manager="on" + + # Shell @@ -1249,135 +1264,86 @@ get_uptime() { } get_packages() { + pkgs() { type -p "$1" >/dev/null && { ((packages+="$2")); managers+="$_, "; }; } + case "$os" in "Linux" | "BSD" | "iPhone OS" | "Solaris") - type -p pacman-key >/dev/null && \ - packages="$(pacman -Qq --color never | wc -l)" + pkgs "pacman-key" "$(pacman -Qq --color never | wc -l)" + pkgs "dpkg" "$(dpkg --get-selections | grep -cv deinstall$)" + pkgs "rpm" "$(rpm -qa | wc -l)" + pkgs "xbps-query" "$(xbps-query -l | wc -l)" + pkgs "apk" "$(apk info | wc -l)" + pkgs "opkg" "$(opkg list-installed | wc -l)" + pkgs "pacman-g2" "$(pacman-g2 -Q | wc -l)" + pkgs "lvu" "$(lvu installed | wc -l)" + pkgs "tce-status" "$(tce-status -i | wc -l)" + pkgs "pkg_info" "$(pkg_info | wc -l)" + pkgs "tazpkg" "$(tazpkg list | wc -l) - 6" + pkgs "sorcery" "$(gaze installed | wc -l)" + pkgs "alps" "$(alps showinstalled | wc -l)" + pkgs "butch" "$(butch list | wc -l)" + pkgs "kpm-pkg" "$(kpm --get-selections | grep -cv deinstall$)" + pkgs "emerge" "$(ls -d /var/db/pkg/*/* | wc -l)" + pkgs "nix-env" "$(ls -d -1 /nix/store/*/ | wc -l)" + pkgs "guix" "$(ls -d -1 /gnu/store/*/ | wc -l)" + pkgs "Compile" "$(ls -d -1 /Programs/*/ | wc -l)" + pkgs "eopkg" "$(ls -1 /var/lib/eopkg/package | wc -l)" + pkgs "crew" "$(ls -l /usr/local/etc/crew/meta/*.filelist | wc -l)" + pkgs "pkgtool" "$(ls -1 /var/log/packages | wc -l)" + pkgs "cave" "$(ls -d -1 /var/db/paludis/repositories/cross-installed/*/data/* \ + /var/db/paludis/repositories/installed/data/* | wc -l)" - type -p dpkg >/dev/null && \ - ((packages+=$(dpkg --get-selections | grep -cv deinstall$))) + case "$kernel_name" in + "FreeBSD") pkgs "pkg" "$(pkg info | wc -l)" ;; + "Solaris") pkgs "pkginfo" "$(pkginfo -i | wc -l)" ;; - type -p pkgtool >/dev/null && \ - ((packages+=$(ls -1 /var/log/packages | wc -l))) + *) + pkgs "pkg" "$(ls -1 /var/db/pkg | wc -l)" - type -p rpm >/dev/null && \ - ((packages+=$(rpm -qa | wc -l))) - - type -p xbps-query >/dev/null && \ - ((packages+=$(xbps-query -l | wc -l))) - - [[ "$os" != "Linux" ]] && type -p pkginfo >/dev/null && \ - ((packages+=$(pkginfo -i | wc -l))) - - type -p emerge >/dev/null && \ - ((packages+=$(ls -d /var/db/pkg/*/* | wc -l))) - - type -p nix-env >/dev/null && \ - ((packages+=$(ls -d -1 /nix/store/*/ | wc -l))) - - type -p guix >/dev/null && \ - ((packages+=$(ls -d -1 /gnu/store/*/ | wc -l))) - - type -p apk >/dev/null && \ - ((packages+=$(apk info | wc -l))) - - type -p opkg >/dev/null && \ - ((packages+=$(opkg list-installed | wc -l))) - - type -p pacman-g2 >/dev/null && \ - ((packages+=$(pacman-g2 -Q | wc -l))) - - type -p lvu >/dev/null && \ - ((packages+=$(lvu installed | wc -l))) - - type -p tce-status >/dev/null && \ - ((packages+=$(tce-status -i | wc -l))) - - type -p Compile >/dev/null && \ - ((packages+=$(ls -d -1 /Programs/*/ | wc -l))) - - type -p eopkg >/dev/null && \ - ((packages+=$(ls -1 /var/lib/eopkg/package | wc -l))) - - type -p pkg_info >/dev/null && \ - ((packages+=$(pkg_info | wc -l))) - - type -p crew >/dev/null && \ - ((packages+=$(ls -l /usr/local/etc/crew/meta/*.filelist | wc -l))) - - type -p tazpkg >/dev/null && \ - ((packages+=$(tazpkg list | wc -l) - 6)) - - type -p sorcery >/dev/null && \ - ((packages+=$(gaze installed | wc -l))) - - type -p alps >/dev/null && \ - ((packages+=$(alps showinstalled | wc -l))) - - type -p kpt >/dev/null && \ - type -p kpm >/dev/null && \ - ((packages+=$(kpm --get-selections | grep -cv deinstall$))) - - if type -p cave >/dev/null; then - package_dir=(/var/db/paludis/repositories/{cross-installed/*,installed}/data/*) - ((packages+=$(ls -d -1 "${package_dir[@]}" | wc -l))) - fi - - type -p butch >/dev/null && \ - ((packages+=$(butch list | wc -l))) - - if type -p pkg >/dev/null; then - case "$kernel_name" in - "FreeBSD") ((packages+=$(pkg info | wc -l))) ;; - *) - ((packages+=$(ls -1 /var/db/pkg | wc -l))) - ((packages == 0)) && ((packages+=$(pkg list | wc -l))) - esac - fi + ((packages == 0)) && \ + pkgs "pkg" "$(pkg list | wc -l)" + ;; + esac ;; "Mac OS X" | "MINIX") - type -p port >/dev/null && \ - ((packages+=$(port installed | wc -l) - 1)) + pkgs "port" "$(port installed | wc -l) - 1)" + pkgs "brew" "$(find /usr/local/Cellar -maxdepth 1 | wc -l) - 1)" + pkgs "pkgin" "$(pkgin list | wc -l)" + ;; - type -p brew >/dev/null && \ - ((packages+=$(find /usr/local/Cellar -maxdepth 1 | wc -l) - 1)) - - type -p pkgin >/dev/null && \ - ((packages+=$(pkgin list | wc -l))) + "AIX"| "FreeMiNT") + pkgs "lslpp" "$(lslpp -J -l -q | grep -cv '^#')" + pkgs "rpm" "$(rpm -qa | wc -l)" ;; "Windows") case "$kernel_name" in - "CYGWIN"*) packages="$(cygcheck -cd | wc -l)" ;; - "MSYS"*) packages="$(pacman -Qq --color never | wc -l)" + "CYGWIN"*) pkgs "cygcheck" "$(cygcheck -cd | wc -l)" ;; + "MSYS"*) pkgs "pacman" "$(pacman -Qq --color never | wc -l)" ;; esac # Count chocolatey packages. [[ -d "/cygdrive/c/ProgramData/chocolatey/lib" ]] && \ - ((packages+=$(ls -1 /cygdrive/c/ProgramData/chocolatey/lib | wc -l))) + pkgs ":" "$(ls -1 /cygdrive/c/ProgramData/chocolatey/lib | wc -l)" ;; "Haiku") packages="$(ls -1 /boot/system/package-links | wc -l)" ;; - "AIX") - packages="$(lslpp -J -l -q | grep -cv '^#')" - ((packages+=$(rpm -qa | wc -l))) - ;; - "IRIX") packages="$(($(versions -b | wc -l)-3))" ;; - - "FreeMiNT") - type -p rpm >/dev/null && \ - packages="$(rpm -qa | wc -l)" - ;; esac - ((packages == 0)) && unset packages + if ((packages == 0)); then + unset packages + + elif [[ "$package_manager" == "on" ]]; then + managers="${managers/pacman-key/pacman}" + packages+=" (${managers::-2})" + fi } get_shell() { @@ -4398,6 +4364,7 @@ INFO: NOTE: You can supply multiple args. eg. 'neofetch --disable cpu gpu' + --package_manager on/off Hide/Show Package Manager names. --os_arch on/off Hide/Show OS architecture. --speed_type type Change the type of cpu speed to display. Possible values: current, min, max, bios, @@ -4593,6 +4560,7 @@ get_args() { while [[ "$1" ]]; do case "$1" in # Info + "--package_manager") package_manager="$2" ;; "--os_arch") os_arch="$2" ;; "--cpu_cores") cpu_cores="$2" ;; "--cpu_speed") cpu_speed="$2" ;; diff --git a/neofetch.1 b/neofetch.1 index 4bfa57ab..6359a76a 100644 --- a/neofetch.1 +++ b/neofetch.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6. -.TH NEOFETCH "1" "May 2018" "Neofetch 4.0.3" "User Commands" +.TH NEOFETCH "1" "June 2018" "Neofetch 4.0.3" "User Commands" .SH NAME Neofetch \- A fast, highly customizable system info script .SH SYNOPSIS @@ -22,6 +22,9 @@ For example: 'info "Memory" memory' would be '\-\-disable memory' .IP NOTE: You can supply multiple args. eg. 'neofetch \fB\-\-disable\fR cpu gpu' .TP +\fB\-\-package_manager\fR on/off +Hide/Show Package Manager names. +.TP \fB\-\-os_arch\fR on/off Hide/Show OS architecture. .TP From 75f845c7afec5019396a719dc7ff8be61fd136e3 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 2 Jun 2018 14:52:08 +1000 Subject: [PATCH 35/82] packages: refactor --- neofetch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/neofetch b/neofetch index 1f291e85..95f7f220 100755 --- a/neofetch +++ b/neofetch @@ -1307,8 +1307,8 @@ get_packages() { ;; "Mac OS X" | "MINIX") - pkgs "port" "$(port installed | wc -l) - 1)" - pkgs "brew" "$(find /usr/local/Cellar -maxdepth 1 | wc -l) - 1)" + pkgs "port" "$(port installed | wc -l) - 1" + pkgs "brew" "$(find /usr/local/Cellar -maxdepth 1 | wc -l) - 1" pkgs "pkgin" "$(pkgin list | wc -l)" ;; From dc9b5519fdbd5217c4f068ca3c6cf348cb07f0b5 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 2 Jun 2018 14:54:11 +1000 Subject: [PATCH 36/82] packages: refactor --- neofetch | 1 + 1 file changed, 1 insertion(+) diff --git a/neofetch b/neofetch index 95f7f220..dc799d08 100755 --- a/neofetch +++ b/neofetch @@ -1342,6 +1342,7 @@ get_packages() { elif [[ "$package_manager" == "on" ]]; then managers="${managers/pacman-key/pacman}" + managers="${managers/kpt-pkg/kpt}" packages+=" (${managers::-2})" fi } From c03c9e12480ea18117d239625eea0faf9f10e6b0 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 2 Jun 2018 15:02:34 +1000 Subject: [PATCH 37/82] packages: refactor --- neofetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neofetch b/neofetch index dc799d08..9df45df9 100755 --- a/neofetch +++ b/neofetch @@ -1343,7 +1343,7 @@ get_packages() { elif [[ "$package_manager" == "on" ]]; then managers="${managers/pacman-key/pacman}" managers="${managers/kpt-pkg/kpt}" - packages+=" (${managers::-2})" + packages+=" (${managers%,*})" fi } From 9bf46946b6a11be5805b8996560a4ec247621dce Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 2 Jun 2018 15:04:27 +1000 Subject: [PATCH 38/82] packages: Remove find usage from brew --- neofetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neofetch b/neofetch index 9df45df9..25c4a010 100755 --- a/neofetch +++ b/neofetch @@ -1308,7 +1308,7 @@ get_packages() { "Mac OS X" | "MINIX") pkgs "port" "$(port installed | wc -l) - 1" - pkgs "brew" "$(find /usr/local/Cellar -maxdepth 1 | wc -l) - 1" + pkgs "brew" "$(files=(/usr/local/Cellar/*) && ((packages+=${#files[@]}))) - 1" pkgs "pkgin" "$(pkgin list | wc -l)" ;; From 3051bbc424a44ffb90597ac4516fe1b49afde6fb Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 2 Jun 2018 15:43:53 +1000 Subject: [PATCH 39/82] packages: Remove ls usage --- neofetch | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/neofetch b/neofetch index 25c4a010..195c25dc 100755 --- a/neofetch +++ b/neofetch @@ -1283,22 +1283,23 @@ get_packages() { pkgs "alps" "$(alps showinstalled | wc -l)" pkgs "butch" "$(butch list | wc -l)" pkgs "kpm-pkg" "$(kpm --get-selections | grep -cv deinstall$)" - pkgs "emerge" "$(ls -d /var/db/pkg/*/* | wc -l)" - pkgs "nix-env" "$(ls -d -1 /nix/store/*/ | wc -l)" - pkgs "guix" "$(ls -d -1 /gnu/store/*/ | wc -l)" - pkgs "Compile" "$(ls -d -1 /Programs/*/ | wc -l)" - pkgs "eopkg" "$(ls -1 /var/lib/eopkg/package | wc -l)" - pkgs "crew" "$(ls -l /usr/local/etc/crew/meta/*.filelist | wc -l)" - pkgs "pkgtool" "$(ls -1 /var/log/packages | wc -l)" - pkgs "cave" "$(ls -d -1 /var/db/paludis/repositories/cross-installed/*/data/* \ - /var/db/paludis/repositories/installed/data/* | wc -l)" + pkgs "emerge" "$(files=(/var/db/pkg/*/*/) && echo ${#files[@]})" + pkgs "nix-env" "$(files=(/nix/store/*/) && echo ${#files[@]})" + pkgs "guix" "$(files=(/gnu/store/*/) && echo ${#files[@]})" + pkgs "Compile" "$(files=(/Programs/*/) && echo ${#files[@]})" + pkgs "eopkg" "$(files=(/var/lib/eopkg/package/*) && echo ${#files[@]})" + pkgs "crew" "$(files=(/usr/local/etc/crew/meta/*.filelist) && echo ${#files[@]})" + pkgs "pkgtool" "$(files=(/var/log/packages/*) && echo ${#files[@]})" + pkgs "cave" "$(files=(/var/db/paludis/repositories/cross-installed/*/data/*/ + /var/db/paludis/repositories/installed/data/*/) && \ + echo ${#files[@]})" case "$kernel_name" in "FreeBSD") pkgs "pkg" "$(pkg info | wc -l)" ;; "Solaris") pkgs "pkginfo" "$(pkginfo -i | wc -l)" ;; *) - pkgs "pkg" "$(ls -1 /var/db/pkg | wc -l)" + pkgs "pkg" "$(files=(/var/db/pkg/*) && echo ${#files[@]})" ((packages == 0)) && \ pkgs "pkg" "$(pkg list | wc -l)" @@ -1325,11 +1326,12 @@ get_packages() { # Count chocolatey packages. [[ -d "/cygdrive/c/ProgramData/chocolatey/lib" ]] && \ - pkgs ":" "$(ls -1 /cygdrive/c/ProgramData/chocolatey/lib | wc -l)" + pkgs ":" "$(files=(/cygdrive/c/ProgramData/chocolatey/lib/*) && echo ${#files[@]})" ;; "Haiku") - packages="$(ls -1 /boot/system/package-links | wc -l)" + files=(/boot/system/package-links/*) + packages="${#files[@]}" ;; "IRIX") From 094fca97bf0bb279448b54416ef36112d6233785 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 2 Jun 2018 16:19:29 +1000 Subject: [PATCH 40/82] packages: Remove wc usage --- neofetch | 75 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 38 insertions(+), 37 deletions(-) diff --git a/neofetch b/neofetch index 195c25dc..7267ec65 100755 --- a/neofetch +++ b/neofetch @@ -1265,68 +1265,69 @@ get_uptime() { get_packages() { pkgs() { type -p "$1" >/dev/null && { ((packages+="$2")); managers+="$_, "; }; } + tots() { IFS=$'\n' read -d "" -ra files < <($1); echo "${#files[@]}"; } + dirc() { echo $#; } case "$os" in "Linux" | "BSD" | "iPhone OS" | "Solaris") - pkgs "pacman-key" "$(pacman -Qq --color never | wc -l)" + pkgs "pacman-key" "$(tots "pacman -Qq --color never")" + pkgs "rpm" "$(tots "rpm -qa")" + pkgs "xbps-query" "$(tots "xbps-query -l")" + pkgs "apk" "$(tots "apk info")" + pkgs "opkg" "$(tots "opkg list-installed")" + pkgs "pacman-g2" "$(tots "pacman-g2 -Q")" + pkgs "lvu" "$(tots "lvu installed")" + pkgs "tce-status" "$(tots "tce-status -i")" + pkgs "pkg_info" "$(tots "pkg_info")" + pkgs "tazpkg" "$(tots "tazpkg list") - 6" + pkgs "sorcery" "$(tots "gaze installed")" + pkgs "alps" "$(tots "alps showinstalled")" + pkgs "butch" "$(tots "butch list")" + pkgs "emerge" "$(dirc /var/db/pkg/*/*/)" + pkgs "nix-env" "$(dirc /nix/store/*/)" + pkgs "guix" "$(dirc /gnu/store/*/)" + pkgs "Compile" "$(dirc /Programs/*/)" + pkgs "eopkg" "$(dirc /var/lib/eopkg/package/*)" + pkgs "crew" "$(dirc /usr/local/etc/crew/meta/*.filelist)" + pkgs "pkgtool" "$(dirc /var/log/packages/*)" + pkgs "cave" "$(dirc /var/db/paludis/repositories/cross-installed/*/data/*/ \ + /var/db/paludis/repositories/installed/data/*/)" + pkgs "kpm-pkg" "$(kpm --get-selections | grep -cv deinstall$)" pkgs "dpkg" "$(dpkg --get-selections | grep -cv deinstall$)" - pkgs "rpm" "$(rpm -qa | wc -l)" - pkgs "xbps-query" "$(xbps-query -l | wc -l)" - pkgs "apk" "$(apk info | wc -l)" - pkgs "opkg" "$(opkg list-installed | wc -l)" - pkgs "pacman-g2" "$(pacman-g2 -Q | wc -l)" - pkgs "lvu" "$(lvu installed | wc -l)" - pkgs "tce-status" "$(tce-status -i | wc -l)" - pkgs "pkg_info" "$(pkg_info | wc -l)" - pkgs "tazpkg" "$(tazpkg list | wc -l) - 6" - pkgs "sorcery" "$(gaze installed | wc -l)" - pkgs "alps" "$(alps showinstalled | wc -l)" - pkgs "butch" "$(butch list | wc -l)" - pkgs "kpm-pkg" "$(kpm --get-selections | grep -cv deinstall$)" - pkgs "emerge" "$(files=(/var/db/pkg/*/*/) && echo ${#files[@]})" - pkgs "nix-env" "$(files=(/nix/store/*/) && echo ${#files[@]})" - pkgs "guix" "$(files=(/gnu/store/*/) && echo ${#files[@]})" - pkgs "Compile" "$(files=(/Programs/*/) && echo ${#files[@]})" - pkgs "eopkg" "$(files=(/var/lib/eopkg/package/*) && echo ${#files[@]})" - pkgs "crew" "$(files=(/usr/local/etc/crew/meta/*.filelist) && echo ${#files[@]})" - pkgs "pkgtool" "$(files=(/var/log/packages/*) && echo ${#files[@]})" - pkgs "cave" "$(files=(/var/db/paludis/repositories/cross-installed/*/data/*/ - /var/db/paludis/repositories/installed/data/*/) && \ - echo ${#files[@]})" case "$kernel_name" in - "FreeBSD") pkgs "pkg" "$(pkg info | wc -l)" ;; - "Solaris") pkgs "pkginfo" "$(pkginfo -i | wc -l)" ;; + "FreeBSD") pkgs "pkg" "$(tots "pkg info")" ;; + "SunOS") pkgs "pkginfo" "$(tots "pkginfo -i")" ;; *) - pkgs "pkg" "$(files=(/var/db/pkg/*) && echo ${#files[@]})" + pkgs "pkg" "$(dirc /var/db/pkg/*)" ((packages == 0)) && \ - pkgs "pkg" "$(pkg list | wc -l)" + pkgs "pkg" "$(tots "pkg list")" ;; esac ;; "Mac OS X" | "MINIX") - pkgs "port" "$(port installed | wc -l) - 1" - pkgs "brew" "$(files=(/usr/local/Cellar/*) && ((packages+=${#files[@]}))) - 1" - pkgs "pkgin" "$(pkgin list | wc -l)" + pkgs "port" "$(tots "port installed") - 1" + pkgs "brew" "$(dirc /usr/local/Cellar/*) - 1" + pkgs "pkgin" "$(tots "pkgin list")" ;; "AIX"| "FreeMiNT") pkgs "lslpp" "$(lslpp -J -l -q | grep -cv '^#')" - pkgs "rpm" "$(rpm -qa | wc -l)" + pkgs "rpm" "$(tots "rpm -qa")" ;; "Windows") case "$kernel_name" in - "CYGWIN"*) pkgs "cygcheck" "$(cygcheck -cd | wc -l)" ;; - "MSYS"*) pkgs "pacman" "$(pacman -Qq --color never | wc -l)" ;; + "CYGWIN"*) pkgs "cygcheck" "$(tots "cygcheck -cd")" ;; + "MSYS"*) pkgs "pacman" "$(tots "pacman -Qq --color never")" ;; esac # Count chocolatey packages. [[ -d "/cygdrive/c/ProgramData/chocolatey/lib" ]] && \ - pkgs ":" "$(files=(/cygdrive/c/ProgramData/chocolatey/lib/*) && echo ${#files[@]})" + pkgs ":" "$(dirc /cygdrive/c/ProgramData/chocolatey/lib/*)" ;; "Haiku") @@ -1335,14 +1336,14 @@ get_packages() { ;; "IRIX") - packages="$(($(versions -b | wc -l)-3))" + packages="$(($(tots "versions -b")-3))" ;; esac if ((packages == 0)); then unset packages - elif [[ "$package_manager" == "on" ]]; then + elif [[ "$package_manager" == "on" && "${managers//,}" ]]; then managers="${managers/pacman-key/pacman}" managers="${managers/kpt-pkg/kpt}" packages+=" (${managers%,*})" From e3afa265f97e10161ff379890b6f7f482978791e Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 2 Jun 2018 16:31:21 +1000 Subject: [PATCH 41/82] packages: only show manager when packages > 0 --- neofetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neofetch b/neofetch index 7267ec65..12e35f18 100755 --- a/neofetch +++ b/neofetch @@ -1264,7 +1264,7 @@ get_uptime() { } get_packages() { - pkgs() { type -p "$1" >/dev/null && { ((packages+="$2")); managers+="$_, "; }; } + pkgs() { type -p "$1" >/dev/null && { ((packages+="$2"));(("$2">0))&&managers+="$_, "; }; } tots() { IFS=$'\n' read -d "" -ra files < <($1); echo "${#files[@]}"; } dirc() { echo $#; } From 89d4126ec11f08a113eabda526f0fa2437e1f8e7 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sat, 2 Jun 2018 19:18:22 +1000 Subject: [PATCH 42/82] misc: Fix more lint errors. --- neofetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neofetch b/neofetch index 86960457..24de8853 100755 --- a/neofetch +++ b/neofetch @@ -1,7 +1,7 @@ #!/usr/bin/env bash # vim: noai:ts=4:sw=4:expandtab # shellcheck source=/dev/null -# shellcheck disable=2016,2009 +# shellcheck disable=2009,2012,2016 # # Neofetch: A command-line system information tool written in bash 3.2+. # https://github.com/dylanaraps/neofetch From 1c015aea18bd84bad37330235021839502ec9ca2 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 3 Jun 2018 06:59:24 +1000 Subject: [PATCH 43/82] travis: Remove lint exceptions. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index aac1b2fc..78b7d757 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,7 @@ script: - time ./neofetch --travis -v # See this wiki page for why we're disabling these errors. # https://github.com/dylanaraps/neofetch/wiki/Shellcheck-Exclusions - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then shellcheck neofetch -e SC1090,SC2009,SC2012,SC2016,SC2034,SC2128,SC2153,SC2154,SC2178,SC2010,SC1004,SC1091,SC1117; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then shellcheck neofetch; fi # The if statement is here to invert the exit code from grep. # grep normally errors if no match is found but we want the opposite. # We invert it so grep fails if a match is found. From aedfa1e92d18c23ccd315ad69543c24eba428ec2 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 3 Jun 2018 07:01:20 +1000 Subject: [PATCH 44/82] docs: update --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index c96d1d27..e829aa1c 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,7 @@ Neofetch supports almost 150 different operating systems. From Linux to Windows, - https://www.tecmint.com/neofetch-shows-linux-system-information-with-logo/ - https://www.youtube.com/watch?v=bgepGW858fc - https://www.linuxuprising.com/2018/05/display-system-information-on-linux.html +- https://esgeeks.com/neofetch-informacion-sistema-linux/ ## Thanks From 4698dbd06e965004f0923bfe82fc2804b6b6093f Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 3 Jun 2018 07:07:52 +1000 Subject: [PATCH 45/82] misc: Surpress last lint errors as they are intended behavior --- neofetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neofetch b/neofetch index 12e35f18..a98b72a9 100755 --- a/neofetch +++ b/neofetch @@ -1,7 +1,7 @@ #!/usr/bin/env bash # vim: noai:ts=4:sw=4:expandtab # shellcheck source=/dev/null -# shellcheck disable=2016,2009 +# shellcheck disable=2009,2012,2016 # # Neofetch: A command-line system information tool written in bash 3.2+. # https://github.com/dylanaraps/neofetch From 175fce87b5aeb310bfa07957d074b238e12f7e81 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 3 Jun 2018 07:31:24 +1000 Subject: [PATCH 46/82] info: Remove get_install_date --- neofetch | 158 ----------------------------------------------------- neofetch.1 | 8 +-- 2 files changed, 1 insertion(+), 165 deletions(-) diff --git a/neofetch b/neofetch index 24de8853..c05c237c 100755 --- a/neofetch +++ b/neofetch @@ -79,7 +79,6 @@ print_info() { # info "Local IP" local_ip # info "Public IP" public_ip # info "Users" users - # info "Install Date" install_date # info "Locale" locale # This only works on glibc systems. info line_break @@ -460,32 +459,6 @@ song_format="%artist% - %album% - %title%" song_shorthand="off" -# Install Date - - -# Whether to show the time in the output -# -# Default: 'on' -# Values: 'on', 'off' -# Flag: --install_time -# -# Example: -# on: 'Thu 14 Apr 2016 11:50 PM' -# off: 'Thu 14 Apr 2016' -install_time="on" - -# Set time format in the output -# -# Default: '24h' -# Values: '12h', '24h' -# Flag: --install_time_format -# -# Example: -# 12h: 'Thu 14 Apr 2016 11:50 PM' -# 24h: 'Thu 14 Apr 2016 23:50' -install_time_format="12h" - - # Text Colors @@ -3297,66 +3270,6 @@ get_users() { users="${users%\,*}" } -get_install_date() { - case "$os" in - "Linux" | "iPhone OS") install_file="/lost+found" ;; - "Mac OS X") install_file="/var/log/install.log" ;; - "Solaris") install_file="/var/sadm/system/logs/install_log" ;; - "Windows") - case "$kernel_name" in - "CYGWIN"*) install_file="/cygdrive/c/Windows/explorer.exe" ;; - "MSYS"* | "MINGW"*) install_file="/c/Windows/explorer.exe" ;; - esac - ;; - "Haiku") install_file="/boot" ;; - "BSD" | "MINIX" | "IRIX") - case "$kernel_name" in - "FreeBSD") install_file="/etc/hostid" ;; - "NetBSD" | "DragonFly"*) install_file="/etc/defaults/rc.conf" ;; - *) install_file="/" ;; - esac - ;; - "AIX") install_file="/var/adm/ras/bosinstlog" ;; - esac - - ls_prog="$(ls --version 2>&1)" - case "$ls_prog" in - *"BusyBox"*) - install_date="$(ls -tdce "$install_file" | awk '{printf $10 " " $7 " " $8 " " $9}')" - ;; - - *"crtime"*) # xpg4 (Solaris) - install_date="$(ls -tdcE "$install_file" | awk '{printf $6 " " $7}')" - ;; - - *"ACFHLRSZ"*) # Toybox - install_date="$(ls -dl "$install_file" | awk '{printf $6 " " $7}')" - ;; - - *"GNU coreutils"*) - install_date="$(ls -tcd --full-time "$install_file" | awk '{printf $6 " " $7}')" - ;; - - *"ACFHLNRS"* | *"RadC1xmnlog"*) # AIX ls / IRIX ls - err "Install Date doesn't work because your 'ls' doesn't support full date/time." - return - ;; - - *"HLOPRSTUWabc"*) # macOS ls - install_date="$(ls -dlctUT "$install_file" | awk '{printf $9 " " $6 " "$7 " " $8}')" - ;; - - *) - install_date="$(ls -dlctT "$install_file" | awk '{printf $9 " " $6 " " $7 " " $8}')" - ;; - esac - - install_date="${install_date//-/ }" - install_date="${install_date%:*}" - IFS=" " read -ra install_date <<< "$install_date" - install_date="$(convert_time "${install_date[@]}")" -} - get_locale() { locale="$sys_locale" } @@ -4265,71 +4178,6 @@ cache_uname() { kernel_machine="${uname[2]}" } -convert_time() { - # Convert ls timestamp to 'Tue 06 Dec 2016 4:58 PM' format. - year="$1" - day="${3#0}" - - # Split time into hours/minutes. - hour="${4/:*}" - min="${4/${hour}}" - - # Get month. (Month code is used for day of week) - # Due to different versions of 'ls', the month can be 1, 01 or Jan. - case "$2" in - 1 | 01 | "Jan") month="Jan"; month_code=0 ;; - 2 | 02 | "Feb") month="Feb"; month_code=3 ;; - 3 | 03 | "Mar") month="Mar"; month_code=3 ;; - 4 | 04 | "Apr") month="Apr"; month_code=6 ;; - 5 | 05 | "May") month="May"; month_code=1 ;; - 6 | 06 | "Jun") month="Jun"; month_code=4 ;; - 7 | 07 | "Jul") month="Jul"; month_code=6 ;; - 8 | 08 | "Aug") month="Aug"; month_code=2 ;; - 9 | 09 | "Sep") month="Sep"; month_code=5 ;; - 10 | "Oct") month="Oct"; month_code=0 ;; - 11 | "Nov") month="Nov"; month_code=3 ;; - 12 | "Dec") month="Dec"; month_code=5 ;; - esac - - # Get leap year. - # Source: http://stackoverflow.com/questions/725098/leap-year-calculation - [[ "$((year % 4))" == 0 && "$((year % 100))" != 0 || "$((year % 400))" == 0 ]] && \ - [[ "$month" =~ (Jan|Feb) ]] && \ - leap_code=1 - - # Calculate day of week. - # Source: http://blog.artofmemory.com/how-to-calculate-the-day-of-the-week-4203.html - year_code="$((${year/??} + (${year/??} / 4) % 7))" - week_day="$(((year_code + month_code + 6 + day - leap_code) % 7))" - - case "$week_day" in - 0) week_day="Sun" ;; - 1) week_day="Mon" ;; - 2) week_day="Tue" ;; - 3) week_day="Wed" ;; - 4) week_day="Thu" ;; - 5) week_day="Fri" ;; - 6) week_day="Sat" ;; - esac - - # Convert 24 hour time to 12 hour time + AM/PM. - case "$install_time_format" in - "12h") - case "$hour" in - [0-9] | 0[0-9] | 1[0-1]) time="${hour/00/12}${min} AM" ;; - *) time="$((hour - 12))${min} PM" ;; - esac - ;; - *) time="$4" ;; - esac - - # Toggle showing the time. - [[ "$install_time" == "off" ]] && unset time - - # Print the install date. - printf "%s" "$week_day $day $month $year $time" -} - get_ppid() { # Get parent process ID of PID. case "$os" in @@ -4464,9 +4312,6 @@ INFO: --song_shorthand on/off Print the Artist/Album/Title on separate lines. --music_player player-name Manually specify a player to use. Available values are listed in the config file - --install_time on/off Enable/Disable showing the time in Install Date output. - --install_time_format 12h/24h - Set time format in Install Date to be 12 hour or 24 hour. TEXT FORMATTING: --colors x x x x x x Changes the text colors in this order: @@ -4614,8 +4459,6 @@ get_args() { "--song_format") song_format="$2" ;; "--song_shorthand") song_shorthand="$2" ;; "--music_player") music_player="$2" ;; - "--install_time") install_time="$2" ;; - "--install_time_format") install_time_format="$2" ;; "--cpu_temp") cpu_temp="$2" [[ "$cpu_temp" == "on" ]] && cpu_temp="C" @@ -4806,7 +4649,6 @@ get_args() { info "Local IP" local_ip info "Public IP" public_ip info "Users" users - info "Install Date" install_date info line_break info cols diff --git a/neofetch.1 b/neofetch.1 index 4bfa57ab..9b6fe6c0 100644 --- a/neofetch.1 +++ b/neofetch.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6. -.TH NEOFETCH "1" "May 2018" "Neofetch 4.0.3" "User Commands" +.TH NEOFETCH "1" "June 2018" "Neofetch 4.0.3" "User Commands" .SH NAME Neofetch \- A fast, highly customizable system info script .SH SYNOPSIS @@ -126,12 +126,6 @@ Print the Artist/Album/Title on separate lines. \fB\-\-music_player\fR player\-name Manually specify a player to use. Available values are listed in the config file -.TP -\fB\-\-install_time\fR on/off -Enable/Disable showing the time in Install Date output. -.TP -\fB\-\-install_time_format\fR 12h/24h -Set time format in Install Date to be 12 hour or 24 hour. .SS "TEXT FORMATTING:" .TP \fB\-\-colors\fR x x x x x x From 14005cac4a7cded6e8cb67fd6214e82cea5668d3 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 3 Jun 2018 08:15:12 +1000 Subject: [PATCH 47/82] misc: Get rid of SC2012/2016 --- neofetch | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/neofetch b/neofetch index 16caf6da..00bdcf04 100755 --- a/neofetch +++ b/neofetch @@ -1,7 +1,7 @@ #!/usr/bin/env bash # vim: noai:ts=4:sw=4:expandtab # shellcheck source=/dev/null -# shellcheck disable=2009,2012,2016 +# shellcheck disable=2009 # # Neofetch: A command-line system information tool written in bash 3.2+. # https://github.com/dylanaraps/neofetch @@ -1335,13 +1335,13 @@ get_shell() { "sh" | "ash" | "dash") ;; "mksh" | "ksh") - shell+="$("$SHELL" -c 'printf "%s" "$KSH_VERSION"')" + shell+="$("$SHELL" -c "printf %s \$KSH_VERSION")" shell="${shell/ * KSH}" shell="${shell/version}" ;; "tcsh") - shell+="$("$SHELL" -c 'printf "%s" "$tcsh"')" + shell+="$("$SHELL" -c "printf %s \$tcsh")" ;; *) @@ -2326,7 +2326,7 @@ get_song() { "google play"*) song="$(gpmdp-remote current)" ;; "rhythmbox"*) song="$(rhythmbox-client --print-playing-format '%ta \n %at \n %tt')" ;; "deadbeef"*) song="$(deadbeef --nowplaying-tf '%artist% \n %album% \n %title%')" ;; - "xmms2d"*) song="$(xmms2 current -f '${artist} \n ${album} \n ${title}')" ;; + "xmms2d"*) song="$(xmms2 current -f "\${artist}"$'\n'"\${album}"$'\n'"\${title}")" ;; "qmmp"*) song="$(qmmp --nowplaying '%p \n %a \n %t')" ;; "gnome-music"*) get_song_dbus "GnomeMusic" ;; "lollypop"*) get_song_dbus "Lollypop" ;; @@ -3385,12 +3385,12 @@ get_ascii() { done <<< "$ascii_data" # Colors. - print="${print//'${c1}'/$c1}" - print="${print//'${c2}'/$c2}" - print="${print//'${c3}'/$c3}" - print="${print//'${c4}'/$c4}" - print="${print//'${c5}'/$c5}" - print="${print//'${c6}'/$c6}" + print="${print//\$\{c1\}/$c1}" + print="${print//\$\{c2\}/$c2}" + print="${print//\$\{c3\}/$c3}" + print="${print//\$\{c4\}/$c4}" + print="${print//\$\{c5\}/$c5}" + print="${print//\$\{c6\}/$c6}" ((text_padding=ascii_length+gap)) printf "%b" "$print" From bee887a3e0be5b4fa6ee3173f307eb9cd5633074 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 3 Jun 2018 08:25:30 +1000 Subject: [PATCH 48/82] misc: docs --- neofetch | 3 +++ 1 file changed, 3 insertions(+) diff --git a/neofetch b/neofetch index 00bdcf04..63f1be8d 100755 --- a/neofetch +++ b/neofetch @@ -1237,6 +1237,9 @@ get_uptime() { } get_packages() { + # pkgs: Run package manager if it exists. + # tots: Count lines in command output. + # dirc: Count files or dirs in a glob. pkgs() { type -p "$1" >/dev/null && { ((packages+="$2"));(("$2">0))&&managers+="$_, "; }; } tots() { IFS=$'\n' read -d "" -ra files < <($1); echo "${#files[@]}"; } dirc() { echo $#; } From d69fd6d839f218f193f2d3b1208907857647621b Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 3 Jun 2018 10:14:53 +1000 Subject: [PATCH 49/82] ascii: simplify handling. --- neofetch | 36 ++++++++++++++---------------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/neofetch b/neofetch index 63f1be8d..5356df19 100755 --- a/neofetch +++ b/neofetch @@ -3364,39 +3364,31 @@ image_backend() { } get_ascii() { - if [[ ! -f "$image_source" ]]; then - err "Ascii: Ascii file not found, using distro ascii." - else + if [[ -f "$image_source" ]]; then ascii_data="$(< "$image_source")" + else + err "Ascii: Ascii file not found, using distro ascii." fi # Set locale to get correct padding. LC_ALL="$sys_locale" - # Turn file into variable. + # Calculate size of ascii file in line length / line count. while IFS=$'\n' read -r line; do - print+="$line -" - # Calculate size of ascii file in line length / line count. - line="${line//[??;?;??m}" - line="${line//[??;?;???m}" - line="${line//}" - line="${line//\$\{??\}}" - line="${line//\\\\/\\}" ((${#line} > ascii_length)) && ascii_length="${#line}" ((++lines)) - done <<< "$ascii_data" + done <<< "${ascii_data//\$\{??\}}" # Colors. - print="${print//\$\{c1\}/$c1}" - print="${print//\$\{c2\}/$c2}" - print="${print//\$\{c3\}/$c3}" - print="${print//\$\{c4\}/$c4}" - print="${print//\$\{c5\}/$c5}" - print="${print//\$\{c6\}/$c6}" + ascii_data="${ascii_data//\$\{c1\}/$c1}" + ascii_data="${ascii_data//\$\{c2\}/$c2}" + ascii_data="${ascii_data//\$\{c3\}/$c3}" + ascii_data="${ascii_data//\$\{c4\}/$c4}" + ascii_data="${ascii_data//\$\{c5\}/$c5}" + ascii_data="${ascii_data//\$\{c6\}/$c6}" ((text_padding=ascii_length+gap)) - printf "%b" "$print" + printf '%b\n' "$ascii_data" LC_ALL=C } @@ -6694,7 +6686,7 @@ EOF "nixos_small") set_colors 4 6 read -rd '' ascii_data <<'EOF' - ${c1}\\\\ \\\\ // + ${c1} \\\\ \\\\ // ==\\\\__\\\\/ // // \\\\// ==// //== @@ -6823,7 +6815,7 @@ EOF "OpenBSD"*) set_colors 3 7 6 1 8 read -rd '' ascii_data <<'EOF' - ${c3} _ +${c3} _ (_) ${c1} | . ${c1} . |L /| . ${c3} _ From a46d2dec073d7467110c4c3ef62e3c485d532064 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 3 Jun 2018 10:20:18 +1000 Subject: [PATCH 50/82] ascii: Update funtoo logo --- neofetch | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/neofetch b/neofetch index 5356df19..db565f23 100755 --- a/neofetch +++ b/neofetch @@ -5849,17 +5849,16 @@ EOF "Funtoo"*) set_colors 5 7 read -rd '' ascii_data <<'EOF' -${c2} _______ ____ - /MMMMMMM/ /MMMM| _____ _____ - __/M${c1}.MMM.${c2}M/_____________|M${c1}.M${c2}MM|/MMMMM\/MMMMM\\ -|MMMM${c1}MM'${c2}MMMMMMMMMMMMMMMMMMM${c1}MM${c2}MMMM${c1}.MMMM..MMMM.${c2}MM\\ -|MM${c1}MMMMMMM${c2}/m${c1}MMMMMMMMMMMMMMMMMMMMMM${c2}MMMM${c1}MM${c2}MMMM${c1}MM${c2}MM| -|MMMM${c1}MM${c2}MMM${c1}MM${c2}MM${c1}MM${c2}MM${c1}MM${c2}MMMMM${c1}\MMM${c2}MMM${c1}MM${c2}MMMM${c1}MM${c2}MMMM${c1}MM${c2}MM| - |MM${c1}MM${c2}MMM${c1}MM${c2}MM${c1}MM${c2}MM${c1}MM${c2}MM${c1}MM${c2}MM${c1}MMM${c2}MMMM${c1}'MMMM''MMMM'${c2}MM/ - |MM${c1}MM${c2}MMM${c1}MM${c2}MM${c1}MM${c2}MM${c1}MM${c2}MM${c1}MM${c2}MM${c1}MMM${c2}MMM\MMMMM/\MMMMM/ - |MM${c1}MM${c2}MMM${c1}MM${c2}MMMMMM${c1}MM${c2}MM${c1}MM${c2}MM${c1}MMMMM'${c2}M| - |MM${c1}MM${c2}MMM${c1}MMMMMMMMMMMMMMMMM MM'${c2}M/ - |MMMMMMMMMMMMMMMMMMMMMMMMMMMM/ +${c1} .dKXXd . + :XXl;:. .OXo +.'OXO'' .''''''''''''''''''''':XNd..'oco.lco, +xXXXXXX, cXXXNNNXXXXNNXXXXXXXXNNNNKOOK; d0O .k + kXX xXo KNNN0 KNN. 'xXNo :c; 'cc. + kXX xNo KNNN0 KNN. :xxxx. 'NNo + kXX xNo loooc KNN. oNNNN. 'NNo + kXX xN0:. KNN' oNNNX' ,XNk + kXX xNNXNNNNNNNNXNNNNNNNNXNNOxXNX0Xl + ... ......................... .;cc;. EOF ;; From 27b2feb21610125290a21b161feb31493123018f Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 3 Jun 2018 10:22:01 +1000 Subject: [PATCH 51/82] travis: Update --- .travis.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 78b7d757..2e21c079 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,12 +11,6 @@ before_install: script: - time ./neofetch --travis -v - # See this wiki page for why we're disabling these errors. - # https://github.com/dylanaraps/neofetch/wiki/Shellcheck-Exclusions - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then shellcheck neofetch; fi - # The if statement is here to invert the exit code from grep. - # grep normally errors if no match is found but we want the opposite. - # We invert it so grep fails if a match is found. # Check for lines longer than 100 chars. - # There are 3 lines that must be longer than 100 chars. - - if (("$(grep '.\{101\}' neofetch | wc -l)" > 3)); then (exit 1); else (exit 0); fi + - if grep '.\{101\}' neofetch; then (exit 1); else (exit 0); fi From ee9939a1dd9c8d8c9debae1c4da6986f3d5dd7bb Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 3 Jun 2018 10:26:20 +1000 Subject: [PATCH 52/82] args: Rename package_manager --- neofetch | 10 +++++----- neofetch.1 | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/neofetch b/neofetch index db565f23..212af18e 100755 --- a/neofetch +++ b/neofetch @@ -150,12 +150,12 @@ uptime_shorthand="on" # # Default: 'on' # Values: 'on', 'off' -# Flag: --package_manager +# Flag: --package_managers # # Example: # on: '900 (pacman, apt)' # off: '900' -package_manager="on" +package_managers="on" # Shell @@ -1319,7 +1319,7 @@ get_packages() { if ((packages == 0)); then unset packages - elif [[ "$package_manager" == "on" && "${managers//,}" ]]; then + elif [[ "$package_managers" == "on" && "${managers//,}" ]]; then managers="${managers/pacman-key/pacman}" managers="${managers/kpt-pkg/kpt}" packages+=" (${managers%,*})" @@ -4211,7 +4211,7 @@ INFO: NOTE: You can supply multiple args. eg. 'neofetch --disable cpu gpu' - --package_manager on/off Hide/Show Package Manager names. + --package_managers on/off Hide/Show Package Manager names. --os_arch on/off Hide/Show OS architecture. --speed_type type Change the type of cpu speed to display. Possible values: current, min, max, bios, @@ -4404,7 +4404,7 @@ get_args() { while [[ "$1" ]]; do case "$1" in # Info - "--package_manager") package_manager="$2" ;; + "--package_managers") package_managers="$2" ;; "--os_arch") os_arch="$2" ;; "--cpu_cores") cpu_cores="$2" ;; "--cpu_speed") cpu_speed="$2" ;; diff --git a/neofetch.1 b/neofetch.1 index c13e4140..7b83df3e 100644 --- a/neofetch.1 +++ b/neofetch.1 @@ -22,7 +22,7 @@ For example: 'info "Memory" memory' would be '\-\-disable memory' .IP NOTE: You can supply multiple args. eg. 'neofetch \fB\-\-disable\fR cpu gpu' .TP -\fB\-\-package_manager\fR on/off +\fB\-\-package_managers\fR on/off Hide/Show Package Manager names. .TP \fB\-\-os_arch\fR on/off From f7f47799ea93a0fcb24e2b2cd6f12bd7099b4b67 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 3 Jun 2018 11:11:26 +1000 Subject: [PATCH 53/82] travis: Use latest shellcheck --- .travis.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.travis.yml b/.travis.yml index 2e21c079..31e8b447 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,14 @@ before_install: - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install screenresolution; fi +install: + # Install a custom version of shellcheck instead of Travis CI's default + - scversion="latest" # or "v0.4.7", or "latest" + - wget "https://storage.googleapis.com/shellcheck/shellcheck-${scversion}.linux.x86_64.tar.xz" + - tar --xz -xvf "shellcheck-${scversion}.linux.x86_64.tar.xz" + - shellcheck() { "shellcheck-${scversion}/shellcheck" "$@"; } + - shellcheck --version + script: - time ./neofetch --travis -v - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then shellcheck neofetch; fi From f2e2cb94e905f6c164cdc4d3a9dc53e1ea4e8cf9 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 3 Jun 2018 11:15:13 +1000 Subject: [PATCH 54/82] travis: Use latest shellcheck --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 31e8b447..1cc33590 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ before_install: install: # Install a custom version of shellcheck instead of Travis CI's default - - scversion="latest" # or "v0.4.7", or "latest" + - scversion="0.5.0" # or "v0.4.7", or "latest" - wget "https://storage.googleapis.com/shellcheck/shellcheck-${scversion}.linux.x86_64.tar.xz" - tar --xz -xvf "shellcheck-${scversion}.linux.x86_64.tar.xz" - shellcheck() { "shellcheck-${scversion}/shellcheck" "$@"; } From 041c021c976f479aacbbe6304b91487b4006205f Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 3 Jun 2018 11:16:18 +1000 Subject: [PATCH 55/82] travis: Use latest shellcheck --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1cc33590..98ce0308 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,6 @@ install: - wget "https://storage.googleapis.com/shellcheck/shellcheck-${scversion}.linux.x86_64.tar.xz" - tar --xz -xvf "shellcheck-${scversion}.linux.x86_64.tar.xz" - shellcheck() { "shellcheck-${scversion}/shellcheck" "$@"; } - - shellcheck --version script: - time ./neofetch --travis -v From f51de7f1396b67aaa14a18fea58890bbd1f7b9d8 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 3 Jun 2018 11:19:11 +1000 Subject: [PATCH 56/82] travis: Use latest shellcheck --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 98ce0308..afc2571b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ before_install: install: # Install a custom version of shellcheck instead of Travis CI's default - - scversion="0.5.0" # or "v0.4.7", or "latest" + - scversion="latest" # or "v0.4.7", or "latest" - wget "https://storage.googleapis.com/shellcheck/shellcheck-${scversion}.linux.x86_64.tar.xz" - tar --xz -xvf "shellcheck-${scversion}.linux.x86_64.tar.xz" - shellcheck() { "shellcheck-${scversion}/shellcheck" "$@"; } From 320ad76b21628dbbbb19fbec56fa3242d232a192 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 3 Jun 2018 12:19:03 +1000 Subject: [PATCH 57/82] docs: update --- CONTRIBUTING.md | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5d3aaf56..f9c0191e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -23,20 +23,15 @@ and variable names. - Keep lines below `100` characters long. - Use `[[ ]]` for tests. -- Double Quote **EVERYTHING**. -- Don’t use single quotes, except for special cases. +- Quote **EVERYTHING**. ### ShellCheck For your contribution to be accepted, your changes need to pass ShellCheck. -Run ShellCheck with the following command: - ```sh -# Why do we exclude numerous tests? -# See: https://github.com/dylanaraps/neofetch/wiki/Shellcheck-Exclusions -shellcheck neofetch -e SC1090,SC2009,SC2012,SC2016,SC2034,SC2128,SC2153,SC2154,SC2178,SC2010,SC1004,SC1091,SC1117 +shellcheck neofetch ``` **Note**: If you have trouble installing ShellCheck. You can open a pull @@ -58,6 +53,8 @@ request on the repo and our Travis.ci hook will run ShellCheck for you. - Use `bash`'s built-in syntax (`file="$(< /path/to/file.txt)")`). - Don’t use `grep "pattern" | awk '{ printf }'`. - Use `awk '/pattern/ { printf }'` +- Don’t use `wc`. + - Use `${#var}` or `${#arr[@]}`. ### If Statements From e12927aa17a983d20fcb1756cc1ab3a94afdf184 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 3 Jun 2018 12:58:44 +1000 Subject: [PATCH 58/82] distro: [haiku] Use read instead of awk --- neofetch | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/neofetch b/neofetch index 212af18e..6fb0d16f 100755 --- a/neofetch +++ b/neofetch @@ -977,7 +977,8 @@ get_distro() { ;; "Haiku") - distro="$(uname -sv | awk '{print $1 " " $2}')" + read -r name version _ < <(uname -sv) + distro="$name $version" ;; "AIX") From 7696f58ea4b3892cf264a6b89df1a44c4cafe738 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 3 Jun 2018 13:14:17 +1000 Subject: [PATCH 59/82] uptime: Remove subshells --- neofetch | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/neofetch b/neofetch index 6fb0d16f..0e9e0163 100755 --- a/neofetch +++ b/neofetch @@ -1197,18 +1197,15 @@ get_uptime() { hours="$((seconds / 60 / 60 % 24)) hours" mins="$((seconds / 60 % 60)) minutes" - # Format the days, hours and minutes. - strip_date() { - case "$1" in - "0 "*) unset "${1/* }" ;; - "1 "*) printf "%s" "${1/s}" ;; - *) printf "%s" "$1" ;; - esac - } + # Remove plural if < 2. + ((${days/ *} == 1)) && days="${days/s}" + ((${hours/ *} == 1)) && hours="${hours/s}" + ((${mins/ *} == 1)) && mins="${mins/s}" - days="$(strip_date "$days")" - hours="$(strip_date "$hours")" - mins="$(strip_date "$mins")" + # Hide empty fields. + ((${days/ *} == 0)) && unset days + ((${hours/ *} == 0)) && unset hours + ((${mins/ *} == 0)) && unset mins uptime="${days:+$days, }${hours:+$hours, }${mins}" uptime="${uptime%', '}" From e3723d277c2535124052c508a2dec0acd15331da Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 3 Jun 2018 14:52:22 +1000 Subject: [PATCH 60/82] packages: Fix performance bug --- neofetch | 100 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 53 insertions(+), 47 deletions(-) diff --git a/neofetch b/neofetch index 0e9e0163..01e356f7 100755 --- a/neofetch +++ b/neofetch @@ -1235,82 +1235,88 @@ get_uptime() { } get_packages() { - # pkgs: Run package manager if it exists. - # tots: Count lines in command output. - # dirc: Count files or dirs in a glob. - pkgs() { type -p "$1" >/dev/null && { ((packages+="$2"));(("$2">0))&&managers+="$_, "; }; } - tots() { IFS=$'\n' read -d "" -ra files < <($1); echo "${#files[@]}"; } - dirc() { echo $#; } + # 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="$_"; } + dir() { ((packages+=$#)); pac "$#"; } + pac() { (($1 > 0)) && managers+="${manager}, "; } + tot() { IFS=$'\n' read -d "" -ra pkgs < <("$@");((packages+="${#pkgs[@]}"));pac "${#pkgs[@]}"; } case "$os" in "Linux" | "BSD" | "iPhone OS" | "Solaris") - pkgs "pacman-key" "$(tots "pacman -Qq --color never")" - pkgs "rpm" "$(tots "rpm -qa")" - pkgs "xbps-query" "$(tots "xbps-query -l")" - pkgs "apk" "$(tots "apk info")" - pkgs "opkg" "$(tots "opkg list-installed")" - pkgs "pacman-g2" "$(tots "pacman-g2 -Q")" - pkgs "lvu" "$(tots "lvu installed")" - pkgs "tce-status" "$(tots "tce-status -i")" - pkgs "pkg_info" "$(tots "pkg_info")" - pkgs "tazpkg" "$(tots "tazpkg list") - 6" - pkgs "sorcery" "$(tots "gaze installed")" - pkgs "alps" "$(tots "alps showinstalled")" - pkgs "butch" "$(tots "butch list")" - pkgs "emerge" "$(dirc /var/db/pkg/*/*/)" - pkgs "nix-env" "$(dirc /nix/store/*/)" - pkgs "guix" "$(dirc /gnu/store/*/)" - pkgs "Compile" "$(dirc /Programs/*/)" - pkgs "eopkg" "$(dirc /var/lib/eopkg/package/*)" - pkgs "crew" "$(dirc /usr/local/etc/crew/meta/*.filelist)" - pkgs "pkgtool" "$(dirc /var/log/packages/*)" - pkgs "cave" "$(dirc /var/db/paludis/repositories/cross-installed/*/data/*/ \ - /var/db/paludis/repositories/installed/data/*/)" - pkgs "kpm-pkg" "$(kpm --get-selections | grep -cv deinstall$)" - pkgs "dpkg" "$(dpkg --get-selections | grep -cv deinstall$)" + # Package Manager Programs. + has "pacman-key" && tot pacman -Qq --color never + has "dpkg" && tot dpkg-query -f '\n' -W + has "rpm" && tot rpm -qa + has "xbps-query" && tot xbps-query -l + has "apk" && tot apk info + has "opkg" && tot opkg list-installed + has "pacman-g2" && tot pacman-g2 -Q + 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 "sorcery" && tot gaze installed + has "alps" && tot alps showinstalled + has "butch" && tot butch list + + # Counting files/dirs. + has "emerge" && dir /var/db/pkg/*/*/ + has "nix-env" && dir /nix/store/*/ + has "guix" && dir /gnu/store/*/ + has "Compile" && dir /Programs/*/ + has "eopkg" && dir /var/lib/eopkg/package/* + has "crew" && dir /usr/local/etc/crew/meta/*.filelist + has "pkgtool" && dir /var/log/packages/* + has "cave" && dir /var/db/paludis/repositories/cross-installed/*/data/*/ \ + /var/db/paludis/repositories/installed/data/*/ + + # Other (Needs complex command) + has "kpm-pkg" && ((packages+="$(kpm --get-selections | grep -cv deinstall$)")) case "$kernel_name" in - "FreeBSD") pkgs "pkg" "$(tots "pkg info")" ;; - "SunOS") pkgs "pkginfo" "$(tots "pkginfo -i")" ;; - + "FreeBSD") has "pkg" && tot pkg info ;; + "SunOS") has "pkginfo" && tot pkginfo -i ;; *) - pkgs "pkg" "$(dirc /var/db/pkg/*)" + has "pkg" && dir /var/db/pkg/* ((packages == 0)) && \ - pkgs "pkg" "$(tots "pkg list")" + has "pkg" && tot pkg list ;; esac ;; "Mac OS X" | "MINIX") - pkgs "port" "$(tots "port installed") - 1" - pkgs "brew" "$(dirc /usr/local/Cellar/*) - 1" - pkgs "pkgin" "$(tots "pkgin list")" + has "port" && tot port installed && ((packages-=1)) + has "brew" && dir /usr/local/Cellar/* + has "pkgin" && tot pkgin list ;; "AIX"| "FreeMiNT") - pkgs "lslpp" "$(lslpp -J -l -q | grep -cv '^#')" - pkgs "rpm" "$(tots "rpm -qa")" + has "lslpp" && ((packages+="$(lslpp -J -l -q | grep -cv '^#')")) + has "rpm" && tot rpm -qa ;; "Windows") case "$kernel_name" in - "CYGWIN"*) pkgs "cygcheck" "$(tots "cygcheck -cd")" ;; - "MSYS"*) pkgs "pacman" "$(tots "pacman -Qq --color never")" ;; + "CYGWIN"*) has "cygcheck" && tot cygcheck -cd ;; + "MSYS"*) has "pacman" && tot pacman -Qq --color never ;; esac # Count chocolatey packages. [[ -d "/cygdrive/c/ProgramData/chocolatey/lib" ]] && \ - pkgs ":" "$(dirc /cygdrive/c/ProgramData/chocolatey/lib/*)" + dir /cygdrive/c/ProgramData/chocolatey/lib/* ;; "Haiku") - files=(/boot/system/package-links/*) - packages="${#files[@]}" + dir /boot/system/package-links/* ;; "IRIX") - packages="$(($(tots "versions -b")-3))" + tot versions -b + ((packages-=3)) ;; esac @@ -1319,7 +1325,7 @@ get_packages() { elif [[ "$package_managers" == "on" && "${managers//,}" ]]; then managers="${managers/pacman-key/pacman}" - managers="${managers/kpt-pkg/kpt}" + managers="${managers/nix-env/nix}" packages+=" (${managers%,*})" fi } From 21103d9ada918047b250caf3a7f40c0754f45c03 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 3 Jun 2018 16:02:16 +1000 Subject: [PATCH 61/82] resolution: Added xwininfo support. --- neofetch | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/neofetch b/neofetch index 01e356f7..8058e89a 100755 --- a/neofetch +++ b/neofetch @@ -2520,6 +2520,11 @@ get_resolution() { esac resolution="${resolution//\*}" + elif type -p xwininfo >/dev/null; then + read -r w h \ + < <(xwininfo -root | awk -F':' '/Width|Height/ {printf $2}') + resolution="${w}x${h}" + elif type -p xdpyinfo >/dev/null; then resolution="$(xdpyinfo | awk '/dimensions:/ {printf $2}')" fi @@ -3687,7 +3692,7 @@ make_thumbnail() { ;; *) - time convert \ + convert \ -background none \ "$image" \ -strip \ From ab01e65fadb5ba3053ba09ee505f5b0b8a903958 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 3 Jun 2018 16:11:37 +1000 Subject: [PATCH 62/82] misc: cleanup --- neofetch | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/neofetch b/neofetch index 8058e89a..6da39790 100755 --- a/neofetch +++ b/neofetch @@ -1379,18 +1379,15 @@ get_de() { ;; "FreeMiNT") - get_wm - - for files in /proc/*; do - case "$files" in - *thing*) de="Thing" ;; - *jinnee*) de="Jinnee" ;; - *tera*) de="Teradesk" ;; - *neod*) de="NeoDesk" ;; - *zdesk*) de="zDesk" ;; - *mdesk*) de="mDesk" ;; - esac - done + freemint_wm=(/proc/*) + case "${freemint_wm[*]}" in + *thing*) de="Thing" ;; + *jinnee*) de="Jinnee" ;; + *tera*) de="Teradesk" ;; + *neod*) de="NeoDesk" ;; + *zdesk*) de="zDesk" ;; + *mdesk*) de="mDesk" ;; + esac ;; *) @@ -1663,15 +1660,13 @@ get_wm_theme() { wm_theme="$(PlistBuddy -c "Print AppleInterfaceStyle" "$global_preferences")" wm_theme_color="$(PlistBuddy -c "Print AppleAquaColorVariant" "$global_preferences")" - [[ -z "$wm_theme" ]] && wm_theme="Light" + [[ -z "$wm_theme" ]] && \ + wm_theme="Light" - if [[ -z "$wm_theme_color" ]] || ((wm_theme_color == 1)); then + [[ -z "$wm_theme_color" ]] || ((wm_theme_color == 1)) && \ wm_theme_color="Blue" - else - wm_theme_color="Graphite" - fi - wm_theme="$wm_theme_color ($wm_theme)" + wm_theme="${wm_theme_color:-Graphite} ($wm_theme)" ;; *"Explorer") From 96bd33c2a01cf90b98bf58d0e9bce0f7b55756c5 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 3 Jun 2018 16:40:06 +1000 Subject: [PATCH 63/82] misc: cleanup --- neofetch | 114 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 58 insertions(+), 56 deletions(-) diff --git a/neofetch b/neofetch index 6da39790..a9032b3c 100755 --- a/neofetch +++ b/neofetch @@ -2698,38 +2698,42 @@ get_term() { # Workaround for macOS systems that # don't support the block below. case "$TERM_PROGRAM" in - "iTerm.app") term="iTerm2" ;; + "iTerm.app") term="iTerm2" ;; "Terminal.app") term="Apple Terminal" ;; - "Hyper") term="HyperTerm" ;; - *) term="${TERM_PROGRAM/\.app}" ;; + "Hyper") term="HyperTerm" ;; + *) term="${TERM_PROGRAM/\.app}" ;; esac # Most likely TosWin2 on FreeMiNT - quick check [[ "$TERM" == "tw52" || "$TERM" == "tw100" ]] && \ term="TosWin2" + [[ "$SSH_CONNECTION" ]] && \ + term="$SSH_TTY" + # Check $PPID for terminal emulator. while [[ -z "$term" ]]; do - if [[ "$SSH_CONNECTION" ]]; then - term="$SSH_TTY"; break - else - parent="$(get_ppid "$parent")" - [[ -z "$parent" ]] && break - name="$(get_process_name "$parent")" - case "${name// }" in - "${SHELL/*\/}" | *"sh" | "screen" | "su"*) ;; - "login"* | *"Login"* | "init" | "(init)") term="$(tty)" ;; - "ruby" | "1" | "systemd" | "sshd"* | "python"* |\ - "USER"*"PID"* | "kdeinit"* | "launchd"*) - break - ;; - "gnome-terminal-") term="gnome-terminal" ;; - *"nvim") term="Neovim Terminal" ;; - *"NeoVimServer"*) term="VimR Terminal" ;; - *"tmux"*) term="tmux" ;; - *) term="${name##*/}" ;; - esac - fi + parent="$(get_ppid "$parent")" + [[ -z "$parent" ]] && break + name="$(get_process_name "$parent")" + + case "${name// }" in + "${SHELL/*\/}"|*"sh"|"screen"|"su"*) ;; + + "login"*|*"Login"*|"init"|"(init)") + term="$(tty)" + ;; + + "ruby"|"1"|"systemd"|"sshd"*|"python"*|"USER"*"PID"*|"kdeinit"*|"launchd"*) + break + ;; + + "gnome-terminal-") term="gnome-terminal" ;; + *"nvim") term="Neovim Terminal" ;; + *"NeoVimServer"*) term="VimR Terminal" ;; + *"tmux"*) term="tmux" ;; + *) term="${name##*/}" ;; + esac done # Log that the function was run. @@ -3351,7 +3355,7 @@ image_backend() { printf '\e[2J\e[H' get_image_size make_thumbnail - display_image + display_image || to_off "Image: $image_backend failed to display the image." ;; *) @@ -3708,54 +3712,52 @@ make_thumbnail() { display_image() { case "$image_backend" in "caca") - img2txt -W "$((width / font_width)))" \ - -H "$((height / font_height))" \ - --gamma=0.6 "$image" ||\ - to_off "Image: libcaca failed to display the image." + img2txt \ + -W "$((width / font_width)))" \ + -H "$((height / font_height))" \ + --gamma=0.6 \ + "$image" ;; "jp2a") - jp2a --width="$((width / font_width))" \ - --height="$((height / font_height))" \ - --colors "$image" ||\ - to_off "Image: jp2a failed to display the image." + jp2a \ + --width="$((width / font_width))" \ + --height="$((height / font_height))" \ + --colors \ + "$image" ;; "kitty") kitty icat \ - --align left \ - --place "$((width / font_width))x$((height / font_height))\ - @${xoffset}x${yoffset}" \ - "$image" ||\ - to_off "Image: kitty failed to display the image." + --align left \ + --place "$((width/font_width))x$((height/font_height))@${xoffset}x${yoffset}" \ + "$image" ;; "pixterm") - pixterm -tc "$((width / font_width))" \ - -tr "$((height / font_height))" \ - "$image" ||\ - to_off "Image: pixterm failed to display the image." + pixterm \ + -tc "$((width / font_width))" \ + -tr "$((height / font_height))" \ + "$image" ;; "sixel") - img2sixel -w "$width" \ - -h "$height" \ - "$image" ||\ - to_off "Image: libsixel failed to display the image." + img2sixel \ + -w "$width" \ + -h "$height" \ + "$image" ;; "termpix") - termpix --width "$((width / font_width))" \ - --height "$((height / font_height))" \ - "$image" ||\ - to_off "Image: termpix failed to display the image." + termpix \ + --width "$((width / font_width))" \ + --height "$((height / font_height))" \ + "$image" ;; "iterm2") - image="$(base64 < "$image")" - printf -v iterm_cmd '\e]1337;File=width=%spx;height=%spx;inline=1:%s' \ - "$width" "$height" "$image" + "$width" "$height" "$(base64 < "$image")" # Tmux requires an additional escape sequence for this to work. [[ -n "$TMUX" ]] && printf -v iterm_cmd '\ePtmux;\e%b\e'\\ "$iterm_cmd" @@ -3764,8 +3766,9 @@ display_image() { ;; "tycat") - tycat -g "${width}x${height}" "$image" ||\ - to_off "Image: tycat failed to display the image." + tycat \ + -g "${width}x${height}" \ + "$image" ;; "w3m") @@ -3776,8 +3779,7 @@ display_image() { # appearing in specific terminal emulators. sleep 0.05 printf '%b\n%s;\n%s\n' "0;1;$xoffset;$yoffset;$width;$height;;;;;$image" 3 4 |\ - "${w3m_img_path:-false}" -bg "$background_color" &>/dev/null ||\ - to_off "Image: w3m-img failed to display the image." + "${w3m_img_path:-false}" -bg "$background_color" &>/dev/null ;; esac } From 55b3925a29ddb7a00450c293f7b9db3365ab2491 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 3 Jun 2018 17:07:04 +1000 Subject: [PATCH 64/82] misc: cleanup --- neofetch | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/neofetch b/neofetch index a9032b3c..53153653 100755 --- a/neofetch +++ b/neofetch @@ -946,9 +946,9 @@ get_distro() { "on") distro="${distro/ ${osx_build}}" ;; "tiny") case "$osx_version" in - "10."[4-7]*) distro="${distro/${codename}/Mac OS X}" ;; + "10."[4-7]*) distro="${distro/${codename}/Mac OS X}" ;; "10."[8-9]* | "10.1"[0-1]*) distro="${distro/${codename}/OS X}" ;; - "10.1"[2-3]*) distro="${distro/${codename}/macOS}" ;; + "10.1"[2-3]*) distro="${distro/${codename}/macOS}" ;; esac distro="${distro/ ${osx_build}}" ;; @@ -1146,7 +1146,7 @@ get_kernel() { if [[ "$os" =~ (BSD|MINIX) && "$distro" == *"$kernel_name"* ]]; then case "$distro_shorthand" in "on" | "tiny") kernel="$kernel_version" ;; - *) unset kernel ;; + *) unset kernel ;; esac fi } @@ -1415,7 +1415,7 @@ get_de() { # the desktop variables are sometimes also set to the # window manager name. This checks to see if WM == DE # and dicards the DE value. - [[ "$wm" && "$de" =~ ^$wm$ ]] && { unset -v de; return; } + [[ "$de" == "$wm" ]] && { unset -v de; return; } ;; esac @@ -3302,7 +3302,7 @@ get_cols() { printf -v block_spaces "%${block_height}s" # Convert the spaces into rows of blocks. - [[ "$blocks" ]] && cols+="${block_spaces// /${blocks}${reset}nl}" + [[ "$blocks" ]] && cols+="${block_spaces// /${blocks}${reset}nl}" [[ "$blocks2" ]] && cols+="${block_spaces// /${blocks2}${reset}nl}" # Add newlines to the string. @@ -3620,10 +3620,9 @@ get_image_size() { read -r width height <<< "$(identify -format "%w %h" "$image")" crop_mode="none" - while (( "$width" >= ("$term_width" / 2) || - "$height" >= "$term_height" )); do - width="$((width / 2))" - height="$((height / 2))" + while ((width >= (term_width / 2) || height >= term_height)); do + ((width=width/2)) + ((height=height/2)) done ;; @@ -3785,13 +3784,8 @@ display_image() { } to_ascii() { - # Log the error. err "$1" - - # This function makes neofetch fallback to ascii mode. image_backend="ascii" - - # Print the ascii art. get_ascii # Set cursor position next image/ascii. @@ -3799,7 +3793,6 @@ to_ascii() { } to_off() { - # This function makes neofetch fallback to off mode. err "$1" image_backend="off" text_padding= From 58e7bf039f864c3e461623edce02060115769443 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Sun, 3 Jun 2018 10:23:38 +0200 Subject: [PATCH 65/82] OS: Add support for Regata OS. --- neofetch | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/neofetch b/neofetch index 53153653..186d4f20 100755 --- a/neofetch +++ b/neofetch @@ -7425,6 +7425,32 @@ ${c2} A EOF ;; + "Regata"*) + set_colors 7 1 4 5 3 2 + read -rd '' ascii_data <<'EOF' +${c1} ddhso+++++osydd + dho/.`hh${c2}.:/+/:.${c1}hhh`:+yd + do-hhhhhh${c2}/sssssss+`${c1}hhhhh./yd + h/`hhhhhhh${c2}-sssssssss:${c1}hhhhhhhh-yd + do`hhhhhhhhh${c2}`ossssssso.${c1}hhhhhhhhhh/d + d/hhhhhhhhhhhh${c2}`/ossso/.${c1}hhhhhhhhhhhh.h + /hhhhhhhhhhhh${c3}`-/osyso/-`${c1}hhhhhhhhhhhh.h +shh${c4}-/ooo+-${c1}hhh${c3}:syyso+osyys/`${c1}hhh${c5}`+oo`${c1}hhh/ +h${c4}`ohhhhhhho`${c3}+yyo.${c1}hhhhh${c3}.+yyo`${c5}.sssssss.${c1}h`h +s${c4}:hhhhhhhhho${c3}yys`${c1}hhhhhhh${c3}.oyy/${c5}ossssssso-${c1}hs +s${c4}.yhhhhhhhy/${c3}yys`${c1}hhhhhhh${c3}.oyy/${c5}ossssssso-${c1}hs +hh${c4}./syyys+.${c1} ${c3}+yy+.${c1}hhhhh${c3}.+yyo`${c5}.ossssso/${c1}h`h +shhh${c4}``.`${c1}hhh${c3}`/syyso++oyys/`${c1}hhh${c5}`+++-`${c1}hh:h +d/hhhhhhhhhhhh${c3}`-/osyso+-`${c1}hhhhhhhhhhhh.h + d/hhhhhhhhhhhh${c6}`/ossso/.${c1}hhhhhhhhhhhh.h + do`hhhhhhhhh${c6}`ossssssso.${c1}hhhhhhhhhh:h + h/`hhhhhhh${c6}-sssssssss:${c1}hhhhhhhh-yd + h+.hhhhhh${c6}+sssssss+${c1}hhhhhh`/yd + dho:.hhh${c6}.:+++/.${c1}hhh`-+yd + ddhso+++++osyhd +EOF + ;; + "Rosa"*) set_colors 4 7 1 read -rd '' ascii_data <<'EOF' From 4637e007429b1c8a597b7a045af6351c7d338ed9 Mon Sep 17 00:00:00 2001 From: Muhammad Herdiansyah Date: Sun, 3 Jun 2018 20:44:00 +0700 Subject: [PATCH 66/82] Packages: Add support for Flatpak --- neofetch | 1 + 1 file changed, 1 insertion(+) diff --git a/neofetch b/neofetch index 186d4f20..c3224b6b 100755 --- a/neofetch +++ b/neofetch @@ -1261,6 +1261,7 @@ get_packages() { has "sorcery" && tot gaze installed has "alps" && tot alps showinstalled has "butch" && tot butch list + has "flatpak" && tot flatpak list # Counting files/dirs. has "emerge" && dir /var/db/pkg/*/*/ From 2cc5516b42989583514e2f4e70d90f375318eb82 Mon Sep 17 00:00:00 2001 From: Muhammad Herdiansyah Date: Sun, 3 Jun 2018 20:44:57 +0700 Subject: [PATCH 67/82] Packages: Add support for Snap --- neofetch | 1 + 1 file changed, 1 insertion(+) diff --git a/neofetch b/neofetch index c3224b6b..6fbded7d 100755 --- a/neofetch +++ b/neofetch @@ -1262,6 +1262,7 @@ get_packages() { has "alps" && tot alps showinstalled has "butch" && tot butch list has "flatpak" && tot flatpak list + has "snap" && tot snap list && ((packages-=1)) # Counting files/dirs. has "emerge" && dir /var/db/pkg/*/*/ From 5fc7dc61cea5c25ecbcc5dd532b8bd0bff23da26 Mon Sep 17 00:00:00 2001 From: Michael Straube Date: Sun, 3 Jun 2018 18:19:09 +0200 Subject: [PATCH 68/82] OS: Add support for Condres OS. --- neofetch | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/neofetch b/neofetch index 186d4f20..8cbc746c 100755 --- a/neofetch +++ b/neofetch @@ -5421,6 +5421,29 @@ oNMMMMMMMMMMMNs` `sy` `oNMMMMMMMMMMMNo EOF ;; + "Condres"*) + set_colors 2 3 6 + read -rd '' ascii_data <<'EOF' +${c1}syyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy+${c3}.+. +${c1}`oyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy+${c3}:++. +${c2}/o${c1}+oyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy/${c3}oo++. +${c2}/y+${c1}syyyyyyyyyyyyyyyyyyyyyyyyyyyyy${c3}+ooo++. +${c2}/hy+${c1}oyyyhhhhhhhhhhhhhhyyyyyyyyy${c3}+oo+++++. +${c2}/hhh+${c1}shhhhhdddddhhhhhhhyyyyyyy${c3}+oo++++++. +${c2}/hhdd+${c1}oddddddddddddhhhhhyyyys${c3}+oo+++++++. +${c2}/hhddd+${c1}odmmmdddddddhhhhyyyy${c3}+ooo++++++++. +${c2}/hhdddmo${c1}odmmmdddddhhhhhyyy${c3}+oooo++++++++. +${c2}/hdddmmms${c1}/dmdddddhhhhyyys${c3}+oooo+++++++++. +${c2}/hddddmmmy${c1}/hdddhhhhyyyyo${c3}+oooo++++++++++: +${c2}/hhdddmmmmy${c1}:yhhhhyyyyy+${c3}+oooo+++++++++++: +${c2}/hhddddddddy${c1}-syyyyyys+${c3}ooooo++++++++++++: +${c2}/hhhddddddddy${c1}-+yyyy+${c3}/ooooo+++++++++++++: +${c2}/hhhhhdddddhhy${c1}./yo:${c3}+oooooo+++++++++++++/ +${c2}/hhhhhhhhhhhhhy${c1}:-.${c3}+sooooo+++++++++++///: +${c2}:sssssssssssso++${c1}${c3}`:/:--------.```````` +EOF + ;; + "Container Linux by CoreOS"*) set_colors 4 7 1 read -rd '' ascii_data <<'EOF' From c461704b361ef28221010e630a4bcd753cc154fb Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 4 Jun 2018 06:41:39 +1000 Subject: [PATCH 69/82] packages: Run flatpak/snap after regular package managers --- neofetch | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/neofetch b/neofetch index 03b5adb9..e9fb3c81 100755 --- a/neofetch +++ b/neofetch @@ -1261,8 +1261,6 @@ get_packages() { has "sorcery" && tot gaze installed has "alps" && tot alps showinstalled has "butch" && tot butch list - has "flatpak" && tot flatpak list - has "snap" && tot snap list && ((packages-=1)) # Counting files/dirs. has "emerge" && dir /var/db/pkg/*/*/ @@ -1288,6 +1286,10 @@ get_packages() { has "pkg" && tot pkg list ;; esac + + # List these last as they accompany regular package managers. + has "flatpak" && tot flatpak list + has "snap" && tot snap list && ((packages-=1)) ;; "Mac OS X" | "MINIX") From 23d02ae90ecfc3bbb461ffc4fc79ef4969a9fe07 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 4 Jun 2018 06:51:30 +1000 Subject: [PATCH 70/82] misc: cleanup --- neofetch | 64 +++++++++++++++++++++++++++++++------------------------- 1 file changed, 36 insertions(+), 28 deletions(-) diff --git a/neofetch b/neofetch index e9fb3c81..15f24278 100755 --- a/neofetch +++ b/neofetch @@ -971,7 +971,7 @@ get_distro() { "Solaris") case "$distro_shorthand" in "on" | "tiny") distro="$(awk 'NR==1{print $1 " " $3;}' /etc/release)" ;; - *) distro="$(awk 'NR==1{print $1 " " $2 " " $3;}' /etc/release)" ;; + *) distro="$(awk 'NR==1{print $1 " " $2 " " $3;}' /etc/release)" ;; esac distro="${distro/\(*}" ;; @@ -1430,11 +1430,15 @@ get_de() { # Format strings. case "$de" in "KDE_SESSION_VERSION"*) de="KDE${de/* = }" ;; - *"MUFFIN"* | "Cinnamon") de="$(cinnamon --version)"; de="${de:-Cinnamon}" ;; *"xfce4"*) de="Xfce4" ;; *"xfce5"*) de="Xfce5" ;; *"xfce"*) de="Xfce" ;; *"mate"*) de="MATE" ;; + + *"MUFFIN"* | "Cinnamon") + de="$(cinnamon --version)"; de="${de:-Cinnamon}" + ;; + *"GNOME"*) de="$(gnome-shell --version)" de="${de/Shell }" @@ -1503,11 +1507,11 @@ get_wm() { ps_line="$(ps -e | grep -o '[S]pectacle\|[A]methyst\|[k]wm\|[c]hun[k]wm')" case "$ps_line" in - *"chunkwm"*) wm="chunkwm" ;; - *"kwm"*) wm="Kwm" ;; - *"Amethyst"*) wm="Amethyst" ;; + *"chunkwm"*) wm="chunkwm" ;; + *"kwm"*) wm="Kwm" ;; + *"Amethyst"*) wm="Amethyst" ;; *"Spectacle"*) wm="Spectacle" ;; - *) wm="Quartz Compositor" ;; + *) wm="Quartz Compositor" ;; esac ;; @@ -1524,15 +1528,14 @@ get_wm() { ;; "FreeMiNT") - wm="Atari AES" - for files in /proc/*; do - case "$files" in - *xaaes*) wm="XaAES" ;; - *myaes*) wm="MyAES" ;; - *naes*) wm="N.AES" ;; - geneva) wm="Geneva" ;; - esac - done + freemint_wm=(/proc/*) + case "${freemint_wm[*]}" in + *xaaes*) wm="XaAES" ;; + *myaes*) wm="MyAES" ;; + *naes*) wm="N.AES" ;; + geneva) wm="Geneva" ;; + *) wm="Atari AES" ;; + esac ;; esac fi @@ -1773,7 +1776,7 @@ get_cpu() { # Get CPU cores. case "$cpu_cores" in "logical" | "on") cores="$(sysctl -n hw.logicalcpu_max)" ;; - "physical") cores="$(sysctl -n hw.physicalcpu_max)" ;; + "physical") cores="$(sysctl -n hw.physicalcpu_max)" ;; esac ;; @@ -1876,7 +1879,9 @@ get_cpu() { cores="$(lparstat -i | awk -F':' '/Online Virtual CPUs/ {printf $2}')" ;; - "physical") cores="$(lparstat -i | awk -F':' '/Active Physical CPUs/ {printf $2}')" + "physical") + cores="$(lparstat -i | awk -F':' '/Active Physical CPUs/ {printf $2}')" + ;; esac ;; @@ -1934,7 +1939,7 @@ get_cpu() { [[ "$cpu_cores" != "off" && "$cores" ]] && \ case "$os" in "Mac OS X") cpu="${cpu/@/(${cores}) @}" ;; - *) cpu="$cpu ($cores)" ;; + *) cpu="$cpu ($cores)" ;; esac # Add CPU speed to the output. @@ -1974,14 +1979,17 @@ get_cpu_usage() { if [[ "$cpu_cores" != "logical" ]]; then case "$os" in "Linux" | "MINIX") cores="$(grep -c "^processor" /proc/cpuinfo)" ;; - "Mac OS X") 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/\)*}" ;; - "AIX") cores="$(lparstat -i | awk -F':' '/Online Virtual CPUs/ {printf $2}')" ;; - "IRIX") cores="$(sysconf NPROC_ONLN)" ;; - "FreeMiNT") cores="$(sysctl -n hw.ncpu)" + "Mac OS X") 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 @@ -1992,10 +2000,10 @@ get_cpu_usage() { # Print the bar. case "$cpu_display" in - "bar") cpu_usage="$(bar "$cpu_usage" 100)" ;; + "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}%" ;; + *) cpu_usage="${cpu_usage}%" ;; esac } From 05b0d1055b3f2572ec3ddcb03f4250c59ad5d583 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 4 Jun 2018 07:36:56 +1000 Subject: [PATCH 71/82] misc: cleanup --- neofetch | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/neofetch b/neofetch index 15f24278..23182103 100755 --- a/neofetch +++ b/neofetch @@ -773,24 +773,24 @@ get_os() { # $kernel_name is set in a function called cache_uname and is # just the output of "uname -s". case "$kernel_name" in - "Darwin") os="$(sw_vers -productName)" ;; - "SunOS") os="Solaris" ;; - "Haiku") os="Haiku" ;; - "MINIX") os="MINIX" ;; - "AIX") os="AIX" ;; - "IRIX"*) os="IRIX" ;; - "FreeMiNT") os="FreeMiNT" ;; + "Darwin") : "$(sw_vers -productName)" ;; + "SunOS") : "Solaris" ;; + "Haiku") : "Haiku" ;; + "MINIX") : "MINIX" ;; + "AIX") : "AIX" ;; + "IRIX"*) : "IRIX" ;; + "FreeMiNT") : "FreeMiNT" ;; "Linux" | "GNU"*) - os="Linux" + : "Linux" ;; *"BSD" | "DragonFly" | "Bitrig") - os="BSD" + : "BSD" ;; "CYGWIN"* | "MSYS"* | "MINGW"*) - os="Windows" + : "Windows" ;; *) @@ -799,6 +799,7 @@ get_os() { exit 1 ;; esac + os="$_" } get_distro() { @@ -1000,8 +1001,9 @@ get_distro() { # Get OS architecture. case "$os" in - "Solaris" | "AIX" | "Haiku" | "IRIX" | "FreeMiNT") machine_arch="$(uname -p)" ;; - *) machine_arch="$kernel_machine" ;; + "Solaris" | "AIX" | "Haiku" | "IRIX" | "FreeMiNT") + machine_arch="$(uname -p)" ;; + *) machine_arch="$kernel_machine" ;; esac [[ "$os_arch" == "on" ]] && \ @@ -1288,8 +1290,8 @@ get_packages() { esac # List these last as they accompany regular package managers. - has "flatpak" && tot flatpak list - has "snap" && tot snap list && ((packages-=1)) + has "flatpak" && tot flatpak list + has "snap" && tot snap list && ((packages-=1)) ;; "Mac OS X" | "MINIX") @@ -1319,8 +1321,7 @@ get_packages() { ;; "IRIX") - tot versions -b - ((packages-=3)) + tot versions -b && ((packages-=3)) ;; esac @@ -3980,15 +3981,15 @@ set_text_colors() { case "$bar_color_total $1" in "distro "[736]) bar_color_total="$(color "$1")" ;; "distro "[0-9]) bar_color_total="$(color "$2")" ;; - *) bar_color_total="$(color "$bar_color_total")" ;; + *) bar_color_total="$(color "$bar_color_total")" ;; esac } color() { case "$1" in - [0-6]) printf '%b\e[3%sm' "$reset" "$1" ;; - 7 | "fg") printf '\e[37m%b' "$reset" ;; - *) printf '\e[38;5;%bm' "$1" ;; + [0-6]) printf '%b\e[3%sm' "$reset" "$1" ;; + 7 | "fg") printf '\e[37m%b' "$reset" ;; + *) printf '\e[38;5;%bm' "$1" ;; esac } @@ -4100,7 +4101,7 @@ cache() { get_cache_dir() { case "$os" in "Mac OS X") cache_dir="/Library/Caches" ;; - *) cache_dir="/tmp" ;; + *) cache_dir="/tmp" ;; esac } From b119a154b08b246426363f9be555917fb4a41063 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 4 Jun 2018 08:33:24 +1000 Subject: [PATCH 72/82] term_font: cleanup --- neofetch | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/neofetch b/neofetch index 23182103..9d436cde 100755 --- a/neofetch +++ b/neofetch @@ -2758,18 +2758,13 @@ get_term_font() { case "$term" in "alacritty"*) - if [[ -f "${XDG_CONFIG_HOME}/alacritty.yml" ]]; then - alacritty_file="${XDG_CONFIG_HOME}/alacritty.yml" + shopt -s nullglob + confs=({$XDG_CONFIG_HOME,$HOME}/{alacritty,}/{.,}alacritty.ym?) + shopt -u nullglob - elif [[ -f "${XDG_CONFIG_HOME}/alacritty/alacritty.yml" ]]; then - alacritty_file="${XDG_CONFIG_HOME}/alacritty/alacritty.yml" + [[ -f "${confs[0]}" ]] || return - elif [[ -f "${HOME}/.alacritty.yml" ]]; then - alacritty_file="${HOME}/.alacritty.yml" - fi - - term_font="$(awk -F ':|#' '/normal:/ {getline; print}' \ - "$alacritty_file")" + term_font="$(awk -F ':|#' '/normal:/ {getline; print}' "${confs[0]}")" term_font="${term_font/*family:}" term_font="${term_font/$'\n'*}" term_font="${term_font/\#*}" @@ -2846,19 +2841,11 @@ END ;; "kitty"*) - if [[ -f "${KITTY_CONFIG_DIRECTORY}/kitty/kitty.conf" ]]; then - kitty_file="${KITTY_CONFIG_DIRECTORY}/kitty/kitty.conf" + shopt -s nullglob + confs=({$KITTY_CONFIG_DIRECTORY,$XDG_CONFIG_HOME,~/Library/Preferences}/kitty/kitty.con?) + shopt -u nullglob - elif [[ -f "${XDG_CONFIG_HOME}/kitty/kitty.conf" ]]; then - kitty_file="${XDG_CONFIG_HOME}/kitty/kitty.conf" - - elif [[ -f "${HOME}/.config/kitty/kitty.conf" ]]; then - kitty_file="${HOME}/.config/kitty/kitty.conf" - - elif [[ -f "${HOME}/Library/Preferences/kitty/kitty.conf" ]]; then - kitty_file="${HOME}/Library/Preferences/kitty/kitty.conf" - - fi + [[ -f "${confs[0]}" ]] || return term_font="$(awk '/^([[:space:]]*|[^#_])font_family[[:space:]]+/ { $1 = ""; @@ -2868,7 +2855,7 @@ END /^([[:space:]]*|[^#_])font_size[[:space:]]+/ { size = $2 } - END { print font " " size}' "${kitty_file}")" + END { print font " " size}' "${confs[0]}")" ;; "konsole"*) From b3235cfff427784f51ea4c8e15e0a30bbfc2355e Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 4 Jun 2018 08:41:23 +1000 Subject: [PATCH 73/82] docs: update --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index afc2571b..8e69d6b6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,4 +20,4 @@ script: - time ./neofetch --travis -v - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then shellcheck neofetch; fi # Check for lines longer than 100 chars. - - if grep '.\{101\}' neofetch; then (exit 1); else (exit 0); fi + - if grep '.\{102\}' neofetch; then (exit 1); else (exit 0); fi From 9b09ed65fa887a50bad0f57cee20deee11d0e36c Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 4 Jun 2018 08:45:21 +1000 Subject: [PATCH 74/82] misc: cleanup --- neofetch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/neofetch b/neofetch index 9d436cde..a4b94cd3 100755 --- a/neofetch +++ b/neofetch @@ -2435,7 +2435,7 @@ get_song() { getline; t=$2 } - END{print a " \n " b " \n " t}')" + END {print a " \n " b " \n " t}')" ;; *) mpc &>/dev/null && song="$(mpc -f '%artist% \n %album% \n %title%' current)" ;; @@ -2996,7 +2996,7 @@ END /^\s*font/ { if(opt==1) a=$2; opt=0 - } END{print a}' "/etc/xdg/termite/config" \ + } END {print a}' "/etc/xdg/termite/config" \ "$termite_config")" ;; From 02c7c90496df5fb4cfca7ee115eb7aca89250ac5 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 4 Jun 2018 08:56:32 +1000 Subject: [PATCH 75/82] misc: cleanup --- neofetch | 153 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 80 insertions(+), 73 deletions(-) diff --git a/neofetch b/neofetch index a4b94cd3..fac82d4b 100755 --- a/neofetch +++ b/neofetch @@ -1042,48 +1042,53 @@ get_model() { "iPhone OS") case "$kernel_machine" in - "iPad1,1") model="iPad" ;; - "iPad2,"[1-4]) model="iPad 2" ;; - "iPad3,"[1-3]) model="iPad 3" ;; - "iPad3,"[4-6]) model="iPad 4" ;; - "iPad6,11" | "iPad 6,12") model="iPad 5" ;; - "iPad4,"[1-3]) model="iPad Air" ;; - "iPad5,"[3-4]) model="iPad Air 2" ;; - "iPad6,"[7-8]) model="iPad Pro (12.9 Inch)" ;; - "iPad6,"[3-4]) model="iPad Pro (9.7 Inch)" ;; - "iPad7,"[1-2]) model="iPad Pro 2 (12.9 Inch)" ;; - "iPad7,"[3-4]) model="iPad Pro (10.5 Inch)" ;; - "iPad2,"[5-7]) model="iPad mini" ;; - "iPad4,"[4-6]) model="iPad mini 2" ;; - "iPad4,"[7-9]) model="iPad mini 3" ;; - "iPad5,"[1-2]) model="iPad mini 4" ;; + "iPad1,1"): "iPad" ;; + "iPad2,"[1-4]): "iPad 2" ;; + "iPad3,"[1-3]): "iPad 3" ;; + "iPad3,"[4-6]): "iPad 4" ;; + "iPad4,"[1-3]): "iPad Air" ;; + "iPad5,"[3-4]): "iPad Air 2" ;; + "iPad6,"[7-8]): "iPad Pro (12.9 Inch)" ;; + "iPad6,"[3-4]): "iPad Pro (9.7 Inch)" ;; + "iPad7,"[1-2]): "iPad Pro 2 (12.9 Inch)" ;; + "iPad7,"[3-4]): "iPad Pro (10.5 Inch)" ;; + "iPad2,"[5-7]): "iPad mini" ;; + "iPad4,"[4-6]): "iPad mini 2" ;; + "iPad4,"[7-9]): "iPad mini 3" ;; + "iPad5,"[1-2]): "iPad mini 4" ;; - "iPhone1,1") model="iPhone" ;; - "iPhone1,2") model="iPhone 3G" ;; - "iPhone2,1") model="iPhone 3GS" ;; - "iPhone3,"[1-3]) model="iPhone 4" ;; - "iPhone4,1") model="iPhone 4S" ;; - "iPhone5,"[1-2]) model="iPhone 5" ;; - "iPhone5,"[3-4]) model="iPhone 5c" ;; - "iPhone6,"[1-2]) model="iPhone 5s" ;; - "iPhone7,2") model="iPhone 6" ;; - "iPhone7,1") model="iPhone 6 Plus" ;; - "iPhone8,1") model="iPhone 6s" ;; - "iPhone8,2") model="iPhone 6s Plus" ;; - "iPhone8,4") model="iPhone SE" ;; - "iPhone9,1" | "iPhone9,3") model="iPhone 7" ;; - "iPhone9,2" | "iPhone9,4") model="iPhone 7 Plus" ;; - "iPhone10,1" | "iPhone10,4") model="iPhone 8" ;; - "iPhone10,2" | "iPhone10,5") model="iPhone 8 Plus" ;; - "iPhone10,3" | "iPhone10,6") model="iPhone X" ;; + "iPad6,11" | "iPad 6,12") + : "iPad 5" + ;; - "iPod1,1") model="iPod touch" ;; - "ipod2,1") model="iPod touch 2G" ;; - "ipod3,1") model="iPod touch 3G" ;; - "ipod4,1") model="iPod touch 4G" ;; - "ipod5,1") model="iPod touch 5G" ;; - "ipod7,1") model="iPod touch 6G" ;; + "iPhone1,1"): "iPhone" ;; + "iPhone1,2"): "iPhone 3G" ;; + "iPhone2,1"): "iPhone 3GS" ;; + "iPhone3,"[1-3]): "iPhone 4" ;; + "iPhone4,1"): "iPhone 4S" ;; + "iPhone5,"[1-2]): "iPhone 5" ;; + "iPhone5,"[3-4]): "iPhone 5c" ;; + "iPhone6,"[1-2]): "iPhone 5s" ;; + "iPhone7,2"): "iPhone 6" ;; + "iPhone7,1"): "iPhone 6 Plus" ;; + "iPhone8,1"): "iPhone 6s" ;; + "iPhone8,2"): "iPhone 6s Plus" ;; + "iPhone8,4"): "iPhone SE" ;; + + "iPhone9,1" | "iPhone9,3"): "iPhone 7" ;; + "iPhone9,2" | "iPhone9,4"): "iPhone 7 Plus" ;; + "iPhone10,1" | "iPhone10,4"): "iPhone 8" ;; + "iPhone10,2" | "iPhone10,5"): "iPhone 8 Plus" ;; + "iPhone10,3" | "iPhone10,6"): "iPhone X" ;; + + "iPod1,1"): "iPod touch" ;; + "ipod2,1"): "iPod touch 2G" ;; + "ipod3,1"): "iPod touch 3G" ;; + "ipod4,1"): "iPod touch 4G" ;; + "ipod5,1"): "iPod touch 5G" ;; + "ipod7,1"): "iPod touch 6G" ;; esac + model="$_" ;; "BSD" | "MINIX") @@ -1783,29 +1788,30 @@ get_cpu() { "iPhone OS") case "$kernel_machine" in - "iPhone1,"[1-2] | "iPod1,1") cpu="Samsung S5L8900 (1) @ 412MHz" ;; - "iPhone2,1") cpu="Samsung S5PC100 (1) @ 600MHz" ;; - "iPhone3,"[1-3] | "iPod4,1") cpu="Apple A4 (1) @ 800MHz" ;; - "iPhone4,1" | "iPod5,1") cpu="Apple A5 (2) @ 800MHz" ;; - "iPhone5,"[1-4]) cpu="Apple A6 (2) @ 1.3GHz" ;; - "iPhone6,"[1-2]) cpu="Apple A7 (2) @ 1.3GHz" ;; - "iPhone7,"[1-2]) cpu="Apple A8 (2) @ 1.4GHz" ;; - "iPhone8,"[1-4]) cpu="Apple A9 (2) @ 1.85GHz" ;; - "iPhone9,"[1-4]) cpu="Apple A10 Fusion (4) @ 2.34GHz" ;; - "iPod2,1") cpu="Samsung S5L8720 (1) @ 533MHz" ;; - "iPod3,1") cpu="Samsung S5L8922 (1) @ 600MHz" ;; - "iPod7,1") cpu="Apple A8 (2) @ 1.1GHz" ;; - "iPad1,1") cpu="Apple A4 (1) @ 1GHz" ;; - "iPad2,"[1-7]) cpu="Apple A5 (2) @ 1GHz" ;; - "iPad3,"[1-3]) cpu="Apple A5X (2) @ 1GHz" ;; - "iPad3,"[4-6]) cpu="Apple A6X (2) @ 1.4GHz" ;; - "iPad4,"[1-3]) cpu="Apple A7 (2) @ 1.4GHz" ;; - "iPad4,"[4-9]) cpu="Apple A7 (2) @ 1.4GHz" ;; - "iPad5,"[1-2]) cpu="Apple A8 (2) @ 1.5GHz" ;; - "iPad5,"[3-4]) cpu="Apple A8X (3) @ 1.5GHz" ;; - "iPad6,"[3-4]) cpu="Apple A9X (2) @ 2.16GHz" ;; - "iPad6,"[7-8]) cpu="Apple A9X (2) @ 2.26GHz" ;; + "iPhone1,"[1-2] | "iPod1,1"): "Samsung S5L8900 (1) @ 412MHz" ;; + "iPhone2,1"): "Samsung S5PC100 (1) @ 600MHz" ;; + "iPhone3,"[1-3] | "iPod4,1"): "Apple A4 (1) @ 800MHz" ;; + "iPhone4,1" | "iPod5,1"): "Apple A5 (2) @ 800MHz" ;; + "iPhone5,"[1-4]): "Apple A6 (2) @ 1.3GHz" ;; + "iPhone6,"[1-2]): "Apple A7 (2) @ 1.3GHz" ;; + "iPhone7,"[1-2]): "Apple A8 (2) @ 1.4GHz" ;; + "iPhone8,"[1-4]): "Apple A9 (2) @ 1.85GHz" ;; + "iPhone9,"[1-4]): "Apple A10 Fusion (4) @ 2.34GHz" ;; + "iPod2,1"): "Samsung S5L8720 (1) @ 533MHz" ;; + "iPod3,1"): "Samsung S5L8922 (1) @ 600MHz" ;; + "iPod7,1"): "Apple A8 (2) @ 1.1GHz" ;; + "iPad1,1"): "Apple A4 (1) @ 1GHz" ;; + "iPad2,"[1-7]): "Apple A5 (2) @ 1GHz" ;; + "iPad3,"[1-3]): "Apple A5X (2) @ 1GHz" ;; + "iPad3,"[4-6]): "Apple A6X (2) @ 1.4GHz" ;; + "iPad4,"[1-3]): "Apple A7 (2) @ 1.4GHz" ;; + "iPad4,"[4-9]): "Apple A7 (2) @ 1.4GHz" ;; + "iPad5,"[1-2]): "Apple A8 (2) @ 1.5GHz" ;; + "iPad5,"[3-4]): "Apple A8X (3) @ 1.5GHz" ;; + "iPad6,"[3-4]): "Apple A9X (2) @ 2.16GHz" ;; + "iPad6,"[7-8]): "Apple A9X (2) @ 2.26GHz" ;; esac + cpu="$_" ;; "BSD") @@ -2099,34 +2105,35 @@ get_gpu() { "iPhone OS") case "$kernel_machine" in - "iPhone1,"[1-2]) gpu="PowerVR MBX Lite 3D" ;; - "iPhone5,"[1-4]) gpu="PowerVR SGX543MP3" ;; - "iPhone8,"[1-4]) gpu="PowerVR GT7600" ;; - "iPad3,"[1-3]) gpu="PowerVR SGX534MP4" ;; - "iPad3,"[4-6]) gpu="PowerVR SGX554MP4" ;; - "iPad5,"[3-4]) gpu="PowerVR GXA6850" ;; - "iPad6,"[3-8]) gpu="PowerVR 7XT" ;; + "iPhone1,"[1-2]): "PowerVR MBX Lite 3D" ;; + "iPhone5,"[1-4]): "PowerVR SGX543MP3" ;; + "iPhone8,"[1-4]): "PowerVR GT7600" ;; + "iPad3,"[1-3]): "PowerVR SGX534MP4" ;; + "iPad3,"[4-6]): "PowerVR SGX554MP4" ;; + "iPad5,"[3-4]): "PowerVR GXA6850" ;; + "iPad6,"[3-8]): "PowerVR 7XT" ;; "iPhone2,1" | "iPhone3,"[1-3] | "iPod3,1" | "iPod4,1" | "iPad1,1") - gpu="PowerVR SGX535" + : "PowerVR SGX535" ;; "iPhone4,1" | "iPad2,"[1-7] | "iPod5,1") - gpu="PowerVR SGX543MP2" + : "PowerVR SGX543MP2" ;; "iPhone6,"[1-2] | "iPad4,"[1-9]) - gpu="PowerVR G6430" + : "PowerVR G6430" ;; "iPhone7,"[1-2] | "iPod7,1" | "iPad5,"[1-2]) - gpu="PowerVR GX6450" + : "PowerVR GX6450" ;; "iPod1,1" | "iPod2,1") - gpu="PowerVR MBX Lite" + : "PowerVR MBX Lite" ;; esac + gpu="$_" ;; "Windows") From c652bfb97b60e6f181758978e2ba2cf7457fa851 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 4 Jun 2018 09:58:27 +1000 Subject: [PATCH 76/82] config: Cleanup and fix bugs --- neofetch | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/neofetch b/neofetch index fac82d4b..2d258637 100755 --- a/neofetch +++ b/neofetch @@ -4015,7 +4015,7 @@ get_full_path() { # For example "Pictures/Wallpapers" --> "/home/dylan/Pictures/Wallpapers" # If the file exists in the current directory, stop here. - [[ -f "${PWD}/${1/*\/}" ]] && { printf '%s\n' "${PWD}/${1/*\/}"; return; } + [[ -f "${PWD}/${1}" ]] && { printf '%s\n' "${PWD}/${1}"; return; } ! cd "${1%/*}" && { err "Error: Directory '${1%/*}' doesn't exist or is inaccessible" @@ -4039,21 +4039,21 @@ get_full_path() { } get_user_config() { - # Check $config_file. - [[ -f "$config_file" ]] && { + mkdir -p "${XDG_CONFIG_HOME}/neofetch/" + + shopt -s nullglob + files=("$XDG_CONFIG_HOME"/neofetch/confi*) + shopt -u nullglob + + # --config /path/to/config.conf + if [[ -f "$config_file" ]]; then source "$config_file" err "Config: Sourced user config. (${config_file})" return - } - mkdir -p "${XDG_CONFIG_HOME}/neofetch/" - # Check ${XDG_CONFIG_HOME}/neofetch and create the - # dir/files if they don't exist. - if [[ -f "${XDG_CONFIG_HOME}/neofetch/config" ]]; then - config_file="${XDG_CONFIG_HOME}/neofetch/config" - - elif [[ -f "${XDG_CONFIG_HOME}/neofetch/config.conf" ]]; then - config_file="${XDG_CONFIG_HOME}/neofetch/config.conf" + elif [[ -f "${files[0]}" ]]; then + source "${files[0]}" + err "Config: Sourced user config. (${config_file})" else config_file="${XDG_CONFIG_HOME}/neofetch/config.conf" @@ -4061,9 +4061,6 @@ get_user_config() { # The config file doesn't exist, create it. printf '%s\n' "$config" > "$config_file" fi - - source "$config_file" - err "Config: Sourced user config. (${config_file})" } bar() { @@ -4656,7 +4653,7 @@ get_distro_ascii() { # This function gets the distro ascii art and colors. # # $ascii_distro is the same as $distro. - case "$( trim "$ascii_distro")" in + case "$(trim "$ascii_distro")" in "AIX"*) set_colors 2 7 read -rd '' ascii_data <<'EOF' From da5f443bec88435163605ae000284138bf59ceb5 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 4 Jun 2018 10:16:28 +1000 Subject: [PATCH 77/82] docs: update --- CHANGELOG.md | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf1f16f8..9a201ebf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,14 +7,23 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +logo + **Contributors** - [**@mstraube**](https://github.com/mstraube) -- [**@iandrewt**](https://github.com/iandrewt") +- [**@iandrewt**](https://github.com/iandrewt) +- [@konimex](https://github.com/konimex) **Operating System** +- Added support for Condres OS. [**@mstraube**](https://github.com/mstraube) - Added support for RedCore Linux. [**@mstraube**](https://github.com/mstraube) +- Added support for Regata OS. [**@mstraube**](https://github.com/mstraube) +- Added support for PureOS. +- Added support for Kibojoe Linux. +- Added support for SharkLinux. +- Added support for Linux Lite. **General** @@ -23,28 +32,51 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - [macOS] Fixed neofetch launching XQuartz. - [misc] Removed `uppercase()`. - [misc] Removed all instances of `export`. +- [misc] Removed all deprecated options and functions. +- [info] Removed `get_install_date()`. **Ascii** - Fixed a bug causing Windows 7 ASCII art to not display. +- Simplified ASCII art handling. +- Updated Funtoo ASCII art. **Image** +- Improved performance of image handling. - Removed `catimg` support (*It didn’t allow us to specify height so we couldn’t accurately place the cursor*). - Fixed `tycat`, `sixel` and `kitty icat` image sizes. +- Simplified `w3m-img` code. **Screenshot** +See: https://github.com/dylanaraps/neofetch/issues/1001 + - Removed screenshot functionality. - Removed screenshot upload functionality. **Info** +- [cpu] Remove extra call to `uname`. +- [cpu] Simplify core calculation. +- [disk] Clean up. - [font] Fix iTerm2 checking for 2 extra profiles that don't exist. [**@iandrewt**](https://github.com/iandrewt") - [gpu] Fixed ATI/AMD branding issue. +- [gpu] Removed `glxinfo` usage (*too slow*). +- [packages] Added support for `flatpak`. +- [packages] Added support for `snap`. +- [packages] Added used package managers to output (`Packages: 900 + (pacman, snap)`). +- [packages] Fixed issues with `pacman` 5.1. +- [packages] Removed `find` usage. +- [packages] Removed `ls` usage. +- [packages] Removed `wc -l` usage. +- [song] Added support for `gmusicbrowser`. - [song] Fixed song detection on macOS. - [song] Fixed song output on systems using `C` locale. +- [term_font] Clean up of config file handling. +- [resolution] Added support for `xwininfo`. ## [4.0.2] - 2018-05-19 From 131719a5ffd964a2cbb9bb11cd4c3500394b8cc1 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 4 Jun 2018 10:16:49 +1000 Subject: [PATCH 78/82] docs: update --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a201ebf..b3543213 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - [**@mstraube**](https://github.com/mstraube) - [**@iandrewt**](https://github.com/iandrewt) -- [@konimex](https://github.com/konimex) +- [**@konimex**](https://github.com/konimex) **Operating System** From 264fc4d02808222b34e8ecbb35f41eff3c44b34c Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 4 Jun 2018 10:17:30 +1000 Subject: [PATCH 79/82] docs: update --- CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b3543213..a3c1f526 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -64,15 +64,15 @@ See: https://github.com/dylanaraps/neofetch/issues/1001 - [font] Fix iTerm2 checking for 2 extra profiles that don't exist. [**@iandrewt**](https://github.com/iandrewt") - [gpu] Fixed ATI/AMD branding issue. - [gpu] Removed `glxinfo` usage (*too slow*). -- [packages] Added support for `flatpak`. -- [packages] Added support for `snap`. +- [packages] Added support for `flatpak`. [**@konimex**](https://github.com/konimex) +- [packages] Added support for `snap`. [**@konimex**](https://github.com/konimex) - [packages] Added used package managers to output (`Packages: 900 (pacman, snap)`). - [packages] Fixed issues with `pacman` 5.1. - [packages] Removed `find` usage. - [packages] Removed `ls` usage. - [packages] Removed `wc -l` usage. -- [song] Added support for `gmusicbrowser`. +- [song] Added support for `gmusicbrowser`. [**@mstraube**](https://github.com/mstraube) - [song] Fixed song detection on macOS. - [song] Fixed song output on systems using `C` locale. - [term_font] Clean up of config file handling. From cc0d232b4862fc8ba2d18d8a430321564dc1eaf7 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 4 Jun 2018 10:21:15 +1000 Subject: [PATCH 80/82] docs: update --- CHANGELOG.md | 54 ++++++++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a3c1f526..6e60d1a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,13 +27,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. **General** -- [output] Added `--json` to output the info in `json`. -- [cursor] Fixed prompt location issues after Neofetch is run. -- [macOS] Fixed neofetch launching XQuartz. -- [misc] Removed `uppercase()`. -- [misc] Removed all instances of `export`. -- [misc] Removed all deprecated options and functions. -- [info] Removed `get_install_date()`. +- **output**: Added `--json` to output the info in `json`. +- **cursor**: Fixed prompt location issues after Neofetch is run. +- **macOS**: Fixed neofetch launching XQuartz. +- **misc**: Removed `uppercase()`. +- **misc**: Removed all instances of `export`. +- **misc**: Removed all deprecated options and functions. +- **info**: Removed `get_install_date()`. **Ascii** @@ -58,25 +58,29 @@ See: https://github.com/dylanaraps/neofetch/issues/1001 **Info** -- [cpu] Remove extra call to `uname`. -- [cpu] Simplify core calculation. -- [disk] Clean up. -- [font] Fix iTerm2 checking for 2 extra profiles that don't exist. [**@iandrewt**](https://github.com/iandrewt") -- [gpu] Fixed ATI/AMD branding issue. -- [gpu] Removed `glxinfo` usage (*too slow*). -- [packages] Added support for `flatpak`. [**@konimex**](https://github.com/konimex) -- [packages] Added support for `snap`. [**@konimex**](https://github.com/konimex) -- [packages] Added used package managers to output (`Packages: 900 +- **cpu**: Remove extra call to `uname`. +- **cpu**: Simplify core calculation. +- **disk**: Clean up. +- **font**: Fix iTerm2 checking for 2 extra profiles that don't exist. + [**@iandrewt**](https://github.com/iandrewt") +- **gpu**: Fixed ATI/AMD branding issue. +- **gpu**: Removed `glxinfo` usage (*too slow*). +- **packages**: Added support for `flatpak`. + [**@konimex**](https://github.com/konimex) +- **packages**: Added support for `snap`. + [**@konimex**](https://github.com/konimex) +- **packages**: Added used package managers to output (`Packages: 900 (pacman, snap)`). -- [packages] Fixed issues with `pacman` 5.1. -- [packages] Removed `find` usage. -- [packages] Removed `ls` usage. -- [packages] Removed `wc -l` usage. -- [song] Added support for `gmusicbrowser`. [**@mstraube**](https://github.com/mstraube) -- [song] Fixed song detection on macOS. -- [song] Fixed song output on systems using `C` locale. -- [term_font] Clean up of config file handling. -- [resolution] Added support for `xwininfo`. +- **packages**: Fixed issues with `pacman` 5.1. +- **packages**: Removed `find` usage. +- **packages**: Removed `ls` usage. +- **packages**: Removed `wc -l` usage. +- **song**: Added support for `gmusicbrowser`. + [**@mstraube**](https://github.com/mstraube) +- **song**: Fixed song detection on macOS. +- **song**: Fixed song output on systems using `C` locale. +- **term\_font**: Clean up of config file handling. +- **resolution**: Added support for `xwininfo`. ## [4.0.2] - 2018-05-19 From d6505023a9ae0f4b48acc4858d26b020778de29e Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 4 Jun 2018 10:46:47 +1000 Subject: [PATCH 81/82] cursor: simplify statement --- neofetch | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/neofetch b/neofetch index 2d258637..28c944e7 100755 --- a/neofetch +++ b/neofetch @@ -4122,15 +4122,11 @@ kde_config_dir() { } dynamic_prompt() { - [[ "$image_backend" == "off" ]] && { printf '\n'; return; } + [[ "$image_backend" == "off" ]] && { printf '\n'; return; } [[ "$image_backend" != "ascii" ]] && lines="$(((height + yoffset) / font_height + 1))" # If the ascii art is taller than the info. - if ((lines > info_height)); then - lines="$((lines - info_height + 1))" - else - lines=1 - fi + ((lines=lines>info_height?lines-info_height+1:1)) printf -v nlines "%${lines}s" printf "%b" "${nlines// /\\n}" From 81beb26972c5b6ec410a359c1f902e8d42f58fd5 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 4 Jun 2018 14:40:18 +1000 Subject: [PATCH 82/82] packages: Added option to display package counts individually. --- neofetch | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/neofetch b/neofetch index 28c944e7..6e4cd890 100755 --- a/neofetch +++ b/neofetch @@ -148,14 +148,15 @@ uptime_shorthand="on" # Show/Hide Package Manager names. # -# Default: 'on' -# Values: 'on', 'off' +# Default: 'tiny' +# Values: 'on', 'tiny' 'off' # Flag: --package_managers # # Example: -# on: '900 (pacman, apt)' -# off: '900' -package_managers="on" +# on: '998 (pacman), 8 (flatpak), 4 (snap)' +# tiny: '908 (pacman, flatpak, snap)' +# off: '908' +package_managers="tiny" # Shell @@ -1248,7 +1249,7 @@ get_packages() { # tot: Count lines in command output. has() { type -p "$1" >/dev/null && manager="$_"; } dir() { ((packages+=$#)); pac "$#"; } - pac() { (($1 > 0)) && managers+="${manager}, "; } + pac() { (($1 > 0)) && { managers+=("$1 (${manager})"); manager_string+="${manager}, "; }; } tot() { IFS=$'\n' read -d "" -ra pkgs < <("$@");((packages+="${#pkgs[@]}"));pac "${#pkgs[@]}"; } case "$os" in @@ -1333,11 +1334,16 @@ get_packages() { if ((packages == 0)); then unset packages - elif [[ "$package_managers" == "on" && "${managers//,}" ]]; then - managers="${managers/pacman-key/pacman}" - managers="${managers/nix-env/nix}" - packages+=" (${managers%,*})" + elif [[ "$package_managers" == "on" ]]; then + printf -v packages '%s, ' "${managers[@]}" + packages="${packages%,*}" + + elif [[ "$package_managers" == "tiny" ]]; then + packages+=" (${manager_string%,*})" fi + + packages="${packages/pacman-key/pacman}" + packages="${packages/nix-env/nix}" } get_shell() { @@ -4210,7 +4216,7 @@ INFO: NOTE: You can supply multiple args. eg. 'neofetch --disable cpu gpu' - --package_managers on/off Hide/Show Package Manager names. + --package_managers on/off Hide/Show Package Manager names . (tiny, on, off) --os_arch on/off Hide/Show OS architecture. --speed_type type Change the type of cpu speed to display. Possible values: current, min, max, bios,