diff --git a/.travis.yml b/.travis.yml index aac1b2fc..8e69d6b6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,14 +9,15 @@ 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" "$@"; } + 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 - # 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. + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then shellcheck neofetch; fi # 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 '.\{102\}' neofetch; then (exit 1); else (exit 0); fi diff --git a/CHANGELOG.md b/CHANGELOG.md index bf1f16f8..6e60d1a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,44 +7,80 @@ 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** -- [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`. +- **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** - 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** -- [font] Fix iTerm2 checking for 2 extra profiles that don't exist. [**@iandrewt**](https://github.com/iandrewt") -- [gpu] Fixed ATI/AMD branding issue. -- [song] Fixed song detection on macOS. -- [song] Fixed song output on systems using `C` locale. +- **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`. ## [4.0.2] - 2018-05-19 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 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 diff --git a/neofetch b/neofetch index de14d01d..11c96dea 100755 --- a/neofetch +++ b/neofetch @@ -1,5 +1,7 @@ #!/usr/bin/env bash # vim: noai:ts=4:sw=4:expandtab +# shellcheck source=/dev/null +# shellcheck disable=2009 # # Neofetch: A command-line system information tool written in bash 3.2+. # https://github.com/dylanaraps/neofetch @@ -32,7 +34,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. @@ -40,7 +42,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' @@ -77,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 @@ -142,6 +143,22 @@ os_arch="on" uptime_shorthand="on" +# Packages + + +# Show/Hide Package Manager names. +# +# Default: 'tiny' +# Values: 'on', 'tiny' 'off' +# Flag: --package_managers +# +# Example: +# on: '998 (pacman), 8 (flatpak), 4 (snap)' +# tiny: '908 (pacman, flatpak, snap)' +# off: '908' +package_managers="tiny" + + # Shell @@ -410,6 +427,7 @@ disk_subtitle="mount" # elisa # exaile # gnome-music +# gmusicbrowser # Google Play # guayadeque # iTunes @@ -457,32 +475,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 @@ -782,22 +774,33 @@ 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" ;; - "FreeMiNT") os="FreeMiNT" ;; + "Darwin") : "$(sw_vers -productName)" ;; + "SunOS") : "Solaris" ;; + "Haiku") : "Haiku" ;; + "MINIX") : "MINIX" ;; + "AIX") : "AIX" ;; + "IRIX"*) : "IRIX" ;; + "FreeMiNT") : "FreeMiNT" ;; + + "Linux" | "GNU"*) + : "Linux" + ;; + + *"BSD" | "DragonFly" | "Bitrig") + : "BSD" + ;; + + "CYGWIN"* | "MSYS"* | "MINGW"*) + : "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 + 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 + os="$_" } get_distro() { @@ -857,7 +860,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" || \ @@ -872,9 +875,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. @@ -945,9 +948,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}}" ;; @@ -970,13 +973,14 @@ 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/\(*}" ;; "Haiku") - distro="$(uname -sv | awk '{print $1 " " $2}')" + read -r name version _ < <(uname -sv) + distro="$name $version" ;; "AIX") @@ -998,13 +1002,13 @@ get_distro() { # Get OS architecture. case "$os" in - "Solaris" | "AIX" | "Haiku" | "IRIX" | "FreeMiNT") machine_arch="$(uname -p)" ;; - *) machine_arch="$(uname -m)" ;; - + "Solaris" | "AIX" | "Haiku" | "IRIX" | "FreeMiNT") + machine_arch="$(uname -p)" ;; + *) machine_arch="$kernel_machine" ;; esac [[ "$os_arch" == "on" ]] && \ - distro+=" ${machine_arch}" + distro+=" $machine_arch" [[ "${ascii_distro:-auto}" == "auto" ]] && \ ascii_distro="$(trim "$distro")" @@ -1030,7 +1034,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)" @@ -1038,49 +1042,54 @@ get_model() { ;; "iPhone OS") - case "$machine_arch" 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" ;; + case "$kernel_machine" in + "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") @@ -1145,7 +1154,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 } @@ -1196,18 +1205,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%', '}" @@ -1237,138 +1243,107 @@ get_uptime() { } get_packages() { + # 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+=("$1 (${manager})"); manager_string+="${manager}, "; }; } + tot() { IFS=$'\n' read -d "" -ra pkgs < <("$@");((packages+="${#pkgs[@]}"));pac "${#pkgs[@]}"; } + case "$os" in "Linux" | "BSD" | "iPhone OS" | "Solaris") - type -p pacman-key >/dev/null && \ - packages="$(pacman -Qq --color never | wc -l)" + # 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 - type -p dpkg >/dev/null && \ - ((packages+=$(dpkg --get-selections | grep -cv deinstall$))) + # 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/*/ - type -p pkgtool >/dev/null && \ - ((packages+=$(ls -1 /var/log/packages | wc -l))) + # Other (Needs complex command) + has "kpm-pkg" && ((packages+="$(kpm --get-selections | grep -cv deinstall$)")) - type -p rpm >/dev/null && \ - ((packages+=$(rpm -qa | wc -l))) + case "$kernel_name" in + "FreeBSD") has "pkg" && tot pkg info ;; + "SunOS") has "pkginfo" && tot pkginfo -i ;; + *) + has "pkg" && dir /var/db/pkg/* - type -p xbps-query >/dev/null && \ - ((packages+=$(xbps-query -l | wc -l))) + ((packages == 0)) && \ + has "pkg" && tot pkg list + ;; + esac - [[ "$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 + # 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") - [[ -d "/usr/local/bin" ]] && \ - packages="$(($(ls -l /usr/local/bin/ | grep -cv "\(../Cellar/\|brew\)") - 1))" + has "port" && tot port installed && ((packages-=1)) + has "brew" && dir /usr/local/Cellar/* + has "pkgin" && tot pkgin list + ;; - type -p port >/dev/null && \ - ((packages+=$(port installed | wc -l) - 1)) - - 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") + has "lslpp" && ((packages+="$(lslpp -J -l -q | grep -cv '^#')")) + has "rpm" && tot rpm -qa ;; "Windows") case "$kernel_name" in - "CYGWIN"*) packages="$(cygcheck -cd | wc -l)" ;; - "MSYS"*) packages="$(pacman -Qq --color never | wc -l)" + "CYGWIN"*) has "cygcheck" && tot cygcheck -cd ;; + "MSYS"*) has "pacman" && tot pacman -Qq --color never ;; esac # Count chocolatey packages. [[ -d "/cygdrive/c/ProgramData/chocolatey/lib" ]] && \ - ((packages+=$(ls -1 /cygdrive/c/ProgramData/chocolatey/lib | wc -l))) + dir /cygdrive/c/ProgramData/chocolatey/lib/* ;; "Haiku") - packages="$(ls -1 /boot/system/package-links | wc -l)" - ;; - - "AIX") - packages="$(lslpp -J -l -q | grep -cv '^#')" - ((packages+=$(rpm -qa | wc -l))) + dir /boot/system/package-links/* ;; "IRIX") - packages="$(($(versions -b | wc -l)-3))" - ;; - - "FreeMiNT") - type -p rpm >/dev/null && \ - packages="$(rpm -qa | wc -l)" + tot versions -b && ((packages-=3)) ;; esac - ((packages == 0)) && unset packages + if ((packages == 0)); then + unset packages + + 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() { @@ -1383,13 +1358,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")" ;; *) @@ -1420,18 +1395,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 ;; *) @@ -1459,7 +1431,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 @@ -1470,11 +1442,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 }" @@ -1543,11 +1519,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 ;; @@ -1564,15 +1540,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 @@ -1672,15 +1647,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")" @@ -1694,15 +1679,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") @@ -1718,7 +1701,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%.*}" @@ -1739,7 +1722,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")" ;; @@ -1754,8 +1737,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")" @@ -1803,35 +1788,36 @@ 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 ;; "iPhone OS") - case "$machine_arch" 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" ;; + case "$kernel_machine" in + "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") @@ -1906,7 +1892,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 ;; @@ -1964,7 +1952,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. @@ -2004,14 +1992,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 @@ -2022,10 +2013,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 } @@ -2119,35 +2110,36 @@ get_gpu() { ;; "iPhone OS") - case "$machine_arch" 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" ;; + case "$kernel_machine" in + "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") @@ -2315,6 +2307,7 @@ get_song() { "elise" "exaile" "gnome-music" + "gmusicbrowser" "Google Play" "guayadeque" "iTunes" @@ -2357,31 +2350,38 @@ 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"*) 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 }')" ;; @@ -2436,11 +2436,22 @@ 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 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; } @@ -2517,8 +2528,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") @@ -2530,6 +2541,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 @@ -2708,38 +2724,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. @@ -2751,18 +2771,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/\#*}" @@ -2781,7 +2796,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 </dev/null 2>&1 ||\ + type -p df &>/dev/null ||\ { 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 @@ -3059,10 +3084,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. @@ -3073,17 +3098,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. @@ -3162,7 +3196,7 @@ get_battery() { "Windows") battery="$(wmic Path Win32_Battery get EstimatedChargeRemaining)" battery="${battery/EstimatedChargeRemaining}" - batttery="$(trim "$battery")%" + battery="$(trim "$battery")%" ;; "Haiku") @@ -3230,66 +3264,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" } @@ -3322,16 +3296,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 @@ -3339,7 +3315,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. @@ -3349,15 +3325,14 @@ 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 # 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 @@ -3366,12 +3341,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 && \ + { image_backend="ascii"; err "Image: Imagemagick not found, falling back to ascii mode."; } case "${image_backend:-off}" in "ascii") get_ascii ;; @@ -3381,27 +3352,23 @@ 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 + display_image || to_off "Image: $image_backend failed to display the image." ;; *) @@ -3414,55 +3381,35 @@ 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() { - 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." - 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 \n" - - # 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}" - # Overwrite padding if ascii_length_force is set. - [[ "$ascii_length_force" ]] && ascii_length="$ascii_length_force" - - text_padding="$((ascii_length + gap))" - printf "%b" "$print" + ((text_padding=ascii_length+gap)) + printf '%b\n' "$ascii_data" LC_ALL=C } @@ -3503,17 +3450,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 ;; @@ -3522,13 +3466,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")" @@ -3571,27 +3516,14 @@ 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/,},~/.nix-profile/}{lib,libexec,lib64,libexec64}/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() { @@ -3606,22 +3538,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 @@ -3630,7 +3560,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" ]] && \ @@ -3638,28 +3568,33 @@ 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" + 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 xdpyinfo >/dev/null 2>&1; then - current_window="$(xdpyinfo | grep -E -o "focus:.*0x[0-9a-f]+")" + if type -p xdo &>/dev/null; then + current_window="$(xdo id)" + + elif type -p xdpyinfo &>/dev/null; then + current_window="$(xdpyinfo | grep -F "focus:")" current_window="${current_window/*window }" - elif type -p xprop >/dev/null 2>&1; then + current_window="${current_window/,*}" + + elif type -p xprop &>/dev/null; then current_window="$(xprop -root _NET_ACTIVE_WINDOW)" current_window="${current_window##* }" fi # 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 @@ -3698,26 +3633,26 @@ 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 ;; - *) 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 @@ -3727,15 +3662,14 @@ 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}" - # 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") @@ -3749,9 +3683,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") @@ -3759,119 +3693,119 @@ 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 \ -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() { 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")" - 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" "$(base64 < "$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") - tycat -g "${width}x${height}" "$image" ||\ - to_off "Image: tycat failed to display the image." + tycat \ + -g "${width}x${height}" \ + "$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. 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 ||\ - to_off "Image: w3m-img failed to display the image." + 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 ;; esac } 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. - printf "%b" "\e[${lines:-0}A\e[9999999D" + printf '\e[%sA\e[9999999D' "${lines:-0}" } to_off() { - # This function makes neofetch fallback to off mode. err "$1" image_backend="off" text_padding= @@ -3912,7 +3846,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 @@ -3932,7 +3866,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)) @@ -3944,7 +3878,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 @@ -3955,7 +3889,7 @@ get_underline() { get_line_break() { # Print it directly. - printf "%b\n" "${zws}" + printf '%b\n' "$zws" # Calculate info height. ((++info_height)) @@ -3966,12 +3900,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 } @@ -3980,7 +3914,7 @@ trim() { set -f # shellcheck disable=2048,2086 set -- $* - printf "%s\\n" "${*//[[:space:]]/ }" + printf '%s\n' "${*//[[:space:]]/ }" set +f } @@ -3996,7 +3930,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 @@ -4047,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" "${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 } @@ -4078,7 +4012,8 @@ stdout() { } err() { - err+="$(color 1)[!]\e[0m $1\n" + err+="$(color 1)[!]${reset} $1 +" } get_full_path() { @@ -4086,13 +4021,13 @@ 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; } - 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##*/}" @@ -4106,35 +4041,32 @@ 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() { - # Check $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 - fi - 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" # The config file doesn't exist, create it. - printf "%s\n" "$config" > "$config_file" + printf '%s\n' "$config" > "$config_file" fi - - source "$config_file" - err "Config: Sourced user config. (${config_file})" } bar() { @@ -4166,7 +4098,7 @@ cache() { get_cache_dir() { case "$os" in "Mac OS X") cache_dir="/Library/Caches" ;; - *) cache_dir="/tmp" ;; + *) cache_dir="/tmp" ;; esac } @@ -4176,13 +4108,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 @@ -4196,15 +4128,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}" @@ -4213,75 +4141,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]}" -} - -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" + kernel_machine="${uname[2]}" } get_ppid() { @@ -4352,6 +4216,7 @@ INFO: NOTE: You can supply multiple args. eg. 'neofetch --disable cpu gpu' + --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, @@ -4418,9 +4283,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: @@ -4546,6 +4408,7 @@ get_args() { while [[ "$1" ]]; do case "$1" in # Info + "--package_managers") package_managers="$2" ;; "--os_arch") os_arch="$2" ;; "--cpu_cores") cpu_cores="$2" ;; "--cpu_speed") cpu_speed="$2" ;; @@ -4567,8 +4430,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" @@ -4703,11 +4564,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" ;; "-h"|"--help") usage ;; "--version") - printf "%s\\n" "Neofetch $version" + printf '%s\n' "Neofetch $version" exit 1 ;; "--gen-man") @@ -4720,10 +4581,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 ;; @@ -4759,7 +4620,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 @@ -4780,6 +4640,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 @@ -4791,7 +4654,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' @@ -5563,6 +5426,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' @@ -5990,17 +5876,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 ;; @@ -6279,6 +6164,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' @@ -6403,6 +6307,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' @@ -6782,7 +6712,7 @@ EOF "nixos_small") set_colors 4 6 read -rd '' ascii_data <<'EOF' - ${c1}\\\\ \\\\ // + ${c1} \\\\ \\\\ // ==\\\\__\\\\/ // // \\\\// ==// //== @@ -6911,7 +6841,7 @@ EOF "OpenBSD"*) set_colors 3 7 6 1 8 read -rd '' ascii_data <<'EOF' - ${c3} _ +${c3} _ (_) ${c1} | . ${c1} . |L /| . ${c3} _ @@ -7357,6 +7287,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' @@ -7505,6 +7453,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' @@ -7648,6 +7622,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' @@ -8424,7 +8419,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 diff --git a/neofetch.1 b/neofetch.1 index 4bfa57ab..7b83df3e 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_managers\fR on/off +Hide/Show Package Manager names. +.TP \fB\-\-os_arch\fR on/off Hide/Show OS architecture. .TP @@ -126,12 +129,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