From 180d5b32c557c6eff25330f9e6d19d9d336317f9 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 18 Dec 2016 20:05:31 +1100 Subject: [PATCH 01/12] Image: Better xrdb command --- neofetch | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/neofetch b/neofetch index b60a978a..4bc46fd8 100755 --- a/neofetch +++ b/neofetch @@ -2785,8 +2785,7 @@ get_term_padding() { case "$term" in "URxvt"*) - border="$(xrdb -query | grep -i "\(URxvt\|\*\)\.InternalBorder")" - border="${border/*:}" + border="$(xrdb -query | awk -F ':' '/^(URxvt|\*).internalBorder/ {printf $2; exit}')" ;; esac } From 63529ddebf8291af1ea1ccdb29060717e7d05f0e Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 18 Dec 2016 23:05:37 +1100 Subject: [PATCH 02/12] Resolution: blank resolution on Windows --- neofetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neofetch b/neofetch index 4bc46fd8..abd4b7b5 100755 --- a/neofetch +++ b/neofetch @@ -1266,7 +1266,7 @@ get_resolution() { height="$(wmic path Win32_VideoController get CurrentVerticalResolution /value)" height="${height//CurrentVerticalResolution'='/}" - [[ "$width" ]] && resolution="${width}x${height}" + [[ "$(trim "$width")" ]] && resolution="${width}x${height}" ;; "Haiku") From 976ae0090f9124602c5b66f8325a17318db98821 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 18 Dec 2016 23:23:58 +1100 Subject: [PATCH 03/12] Battery: Fix % sign when no battery detected on Windows --- neofetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neofetch b/neofetch index abd4b7b5..bfd94e62 100755 --- a/neofetch +++ b/neofetch @@ -1616,7 +1616,7 @@ get_battery() { "Windows") battery="$(wmic Path Win32_Battery get EstimatedChargeRemaining /value)" battery="${battery/EstimatedChargeRemaining'='}" - [[ "$battery" ]] && battery+="%" + [[ "$(trim "$battery")" ]] && battery="%" ;; "Haiku") From de15bf52c0a7a165434901af34c5e2435b126d75 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Sun, 18 Dec 2016 23:49:31 +1100 Subject: [PATCH 04/12] General: Revert PATH changes and add /usr/sbin and /sbin to PATH --- neofetch | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/neofetch b/neofetch index bfd94e62..d3ad0c27 100755 --- a/neofetch +++ b/neofetch @@ -16,9 +16,8 @@ XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-${HOME}/.config}" export LC_ALL=C export LANG=C -# Set PATH to binary directories only -# This solves issues with neofetch opening the pacman game. -export PATH="/usr/sbin:/usr/bin:/sbin:/bin" +# Add /usr/sbin and /sbin to PATH. +export PATH="${PATH}:/usr/sbin:/sbin" # Set no case match. shopt -s nocasematch @@ -376,6 +375,14 @@ get_uptime() { } get_packages() { + # Remove /usr/games from $PATH. + # This solves issues with neofetch opening the + # 'pacman' game. + local PATH=":${PATH}:" + local PATH="${PATH/':/usr/games:'/:}" + local PATH="${PATH%:}" + local PATH="${PATH#:}" + case "$os" in "Linux" | "iPhone OS" | "Solaris") type -p pacman >/dev/null && \ From 23305f0486209d3c3d339a1069f8461cf43341e5 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 19 Dec 2016 00:40:55 +1100 Subject: [PATCH 05/12] General: Reorder PATH --- neofetch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neofetch b/neofetch index d3ad0c27..01a750ce 100755 --- a/neofetch +++ b/neofetch @@ -17,7 +17,7 @@ export LC_ALL=C export LANG=C # Add /usr/sbin and /sbin to PATH. -export PATH="${PATH}:/usr/sbin:/sbin" +export PATH="/usr/sbin:/sbin:${PATH}" # Set no case match. shopt -s nocasematch From 282c8ceb5ace2e99623ca1c267a5563c0eb75cbf Mon Sep 17 00:00:00 2001 From: Alexander 'z33ky' Hirsch <1zeeky@gmail.com> Date: Sun, 18 Dec 2016 17:39:53 +0100 Subject: [PATCH 06/12] Song: Add support for xmms2 --- neofetch | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/neofetch b/neofetch index 01a750ce..9892543c 100755 --- a/neofetch +++ b/neofetch @@ -1145,7 +1145,7 @@ get_memory() { get_song() { # This is absurdly long. - player="$(ps x | awk '!(/awk|Helper|Cache/) && /mpd|cmus|mocp|spotify|Google Play|iTunes.app|rhythmbox|banshee|amarok|deadbeef|audacious|gnome-music|lollypop|clementine|pragha/ {printf $5 " " $6; exit}')" + player="$(ps x | awk '!(/awk|Helper|Cache/) && /mpd|cmus|mocp|spotify|Google Play|iTunes.app|rhythmbox|banshee|amarok|deadbeef|audacious|xmms2d|gnome-music|lollypop|clementine|pragha/ {printf $5 " " $6; exit}')" get_song_dbus() { # Multiple players use an almost identical dbus command to get the information. @@ -1166,6 +1166,7 @@ get_song() { "rhythmbox"*) song="$(rhythmbox-client --print-playing)" ;; "deadbeef"*) song="$(deadbeef --nowplaying '%a - %t')" ;; "audacious"*) song="$(audtool current-song)" ;; + "xmms2d"*) song="$(xmms2 current -f '${artist} - ${title}')" ;; "gnome-music"*) get_song_dbus "GnomeMusic" ;; "lollypop"*) get_song_dbus "Lollypop" ;; "clementine"*) get_song_dbus "clementine" ;; From d754a15e838f1b630111ff37065165b1b1df7c4a Mon Sep 17 00:00:00 2001 From: Muhammad Herdiansyah Date: Mon, 19 Dec 2016 00:28:58 +0700 Subject: [PATCH 07/12] Docs: CHANGELOG --- CHANGELOG.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 063d6206..c2aac2be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ - **[@konimex](https://github.com/konimex)** - **[@iandrewt](https://github.com/iandrewt)** - **[@jorgegonzalez](https://github.com/jorgegonzalez)** - +- **[@z33ky](https://github.com/z33ky)** ## IRC @@ -69,7 +69,7 @@ Neofetch now has an irc channel at `#neofetch` on Freenode. If you have any ques **~~Birthday~~ Install Date**
- Renamed `get_birthday()` -- > `get_install_date()` -- Removed all `date` usage from `get_install_date()`. +- Removed all `date` usage from `get_install_date()`. - Added a new function called `convert_time()` which takes the time stamped `ls` output and converts it to a pretty format. The function only uses bash so its much faster than calling `date`. This makes things simple and keeps the output consistent across all Operating Systems. Example: `2016-12-06 16:58:58.000000000` --> `Tue 06 Dec 2016 4:58 PM` **Disk**
@@ -93,6 +93,7 @@ Neofetch now has an irc channel at `#neofetch` on Freenode. If you have any ques - [cmus] Simplify block and fix `artistsort` bug. - Removed `state` detection. - Removed duplicate `dbus-send` commands. +- Added support for xmms2. **[@z33ky](https://github.com/z33ky)** **Battery**
From 6339b2f27a3c9feddbc88fcd8b1099fff3068a1f Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 19 Dec 2016 11:54:52 +1100 Subject: [PATCH 08/12] OS: Add inital support for Minix (Konimex) --- ascii/distro/minix | 17 +++++++++++++++++ neofetch | 38 ++++++++++++++++++++++---------------- 2 files changed, 39 insertions(+), 16 deletions(-) create mode 100644 ascii/distro/minix diff --git a/ascii/distro/minix b/ascii/distro/minix new file mode 100644 index 00000000..a0ff143c --- /dev/null +++ b/ascii/distro/minix @@ -0,0 +1,17 @@ +${c2} -sdhyo+:-` -/syymm: + sdyooymmNNy. `` .smNmmdysNd + odyoso+syNNmysoyhhdhsoomNmm+/osdm/ + :hhy+-/syNNmddhddddddmNMNo:sdNd: + `smNNdNmmNmddddddddddmmmmmmmy` + `ohhhhdddddmmNNdmddNmNNmdddddmdh- + odNNNmdyo/:/-/hNddNy-`..-+ydNNNmd: + `+mNho:` smmd/ sNNh :dmms` -+ymmo. +-od/ -m${c1}mm${c2}mo -NN+ +m${c1}mm${c2}m- yms: ++sms -.` :so: .NN+ :os/ .-`mNh: +.-hyh+:////- -sNNd:` .--://ohNs- + `:hNNNNNNNMMd/sNMmhsdMMh/ymmNNNmmNNy/ + -+sNNNNMMNNNsmNMo: :NNmymNNNNMMMms: + //oydNMMMMydMMNysNMMmsMMMMMNyo/` + ../-yNMMy--/::/-.sMMmos+.` + -+oyhNsooo+omy/``` + `::ohdmds-` diff --git a/neofetch b/neofetch index 9892543c..186b9221 100755 --- a/neofetch +++ b/neofetch @@ -37,6 +37,7 @@ get_os() { "CYGWIN"*) os="Windows" ;; "SunOS") os="Solaris" ;; "Haiku") os="Haiku" ;; + "MINIX") os="MINIX" ;; *) printf "%s\n" "Unknown OS detected: $kernel_name"; exit 1 ;; esac } @@ -145,7 +146,7 @@ get_distro() { os_arch="off" ;; - "BSD") + "BSD" | "MINIX") case "$distro_shorthand" in "tiny" | "on") distro="$kernel_name" ;; *) distro="$kernel_name $kernel_version" ;; @@ -249,7 +250,7 @@ get_model() { esac ;; - "BSD") + "BSD" | "MINIX") model="$(sysctl -n hw.vendor hw.product)" ;; @@ -283,6 +284,8 @@ get_title() { } get_kernel() { + [[ "$os" == "MINIX" ]] && local os="BSD" + case "$kernel_shorthand" in "on") kernel="$kernel_version" ;; "off") kernel="$kernel_name $kernel_version" ;; @@ -309,7 +312,7 @@ get_uptime() { *) # Get uptime in seconds case "$os" in - "Linux" | "Windows") + "Linux" | "Windows" | "MINIX") seconds="$(< /proc/uptime)" seconds="${seconds/.*}" ;; @@ -448,7 +451,7 @@ get_packages() { fi ;; - "Mac OS X") + "Mac OS X" | "MINIX") [[ -d "/usr/local/bin" ]] && \ packages="$(($(ls -l /usr/local/bin/ | grep -cv "\(../Cellar/\|brew\)") - 1))" @@ -720,7 +723,7 @@ get_cpu() { # NetBSD emulates the linux /proc filesystem instead of using sysctl for hw # information so we have to use this block below which temporarily sets the # OS to 'Linux' for the duration of this function. - [[ "$distro" == "NetBSD"* ]] && local os="Linux" + [[ "$distro" == "NetBSD"* || "$os" == "MINIX" ]] && local os="Linux" case "$os" in "Linux" | "Windows") @@ -936,7 +939,7 @@ get_cpu_usage() { # Get cores if unset if [[ "$cpu_cores" == "off" ]]; then case "$os" in - "Linux") cores="$(grep -c "^processor" /proc/cpuinfo)" ;; + "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")" ;; @@ -1038,7 +1041,7 @@ get_gpu() { esac ;; - "BSD" | "Solaris") + "BSD" | "Solaris" | "MINIX") case "$kernel_name" in "FreeBSD"* | "DragonFly"*) gpu="$(pciconf -lv | grep -B 4 -F "VGA" | grep -F "device")" @@ -1095,7 +1098,7 @@ get_memory() { mem_used="$(((${mem_wired//.} + ${mem_active//.} + ${mem_compressed//.}) * 4 / 1024))" ;; - "BSD") + "BSD" | "MINIX") # Mem total case "$kernel_name" in "NetBSD"*) mem_total="$(($(sysctl -n hw.physmem64) / 1024 / 1024))" ;; @@ -1109,7 +1112,10 @@ get_memory() { mem_free="$(top -d 1 | awk -F ',' '/^Mem:/ {print $5}')" mem_free="${mem_free/M Free}" ;; - + "MINIX") + mem_free="$(top -d 1 | awk -F ',' '/^Memory:/ {print $2}')" + mem_free="${mem_free/M Free}" + ;; "OpenBSD"*) ;; *) mem_free="$(($(vmstat | awk 'END{printf $5}') / 1024))" ;; esac @@ -1226,7 +1232,7 @@ get_song() { get_resolution() { case "$os" in - "Linux" | "BSD" | "Solaris") + "Linux" | "BSD" | "Solaris" | "MINIX") if type -p xrandr >/dev/null; then case "$refresh_rate" in "on") resolution="$(xrandr --nograb --current | awk 'match($0,/[0-9]*\.[0-9]*\*/) {printf $1 " @ " substr($0,RSTART,RLENGTH) "Hz, "}')" ;; @@ -1484,7 +1490,7 @@ get_term() { case "${name// }" in "${SHELL/*\/}" | *"sh" | "tmux"* | "screen" | "su") get_term "$parent" ;; - "login"* | *"Login"* | "init") term="$(tty)" ;; + "login"* | *"Login"* | "init" | "(init)") term="$(tty)" ;; "ruby" | "1" | "systemd" | "sshd"* | "python"* | "USER"*"PID"*) unset term ;; "gnome-terminal-") term="gnome-terminal" ;; *) term="${name##*/}" ;; @@ -1645,7 +1651,7 @@ get_battery() { get_local_ip() { case "$os" in - "Linux" | "BSD" | "Solaris") + "Linux" | "BSD" | "Solaris" | "MINIX") local_ip="$(ip route get 1 | awk '{print $NF;exit}')" [[ -z "$local_ip" ]] && local_ip="$(ifconfig | awk '/broadcast/ {print $2}')" ;; @@ -1697,9 +1703,9 @@ get_install_date() { install_date="$(ls -lUT /var/log/install.log | awk '{printf $9 " " $6 " " $7 " " $8}')" ;; - "BSD") + "BSD" | "MINIX") case "$kernel_name" in - "OpenBSD"* | "Bitrig"*) + "OpenBSD"* | "Bitrig"* | "MINIX") install_file="/" ;; @@ -1934,7 +1940,7 @@ get_w3m_img_path() { get_wallpaper() { case "$os" in - "Linux" | "BSD" | "Solaris") + "Linux" | "BSD" | "Solaris" | "MINIX") # Get DE if user has disabled the function. (( "$de_run" != 1 )) && get_de @@ -2447,7 +2453,7 @@ get_distro_colors() { set_colors 2 1 ;; - "Debian"* | "Ubuntu"* | "DragonFly"* | "PacBSD"* | "Oracle"* | "BlankOn"* | "DracOS"* | "Peppermint"*) + "Debian"* | "Ubuntu"* | "DragonFly"* | "PacBSD"* | "Oracle"* | "BlankOn"* | "DracOS"* | "Peppermint"* | "Minix"*) set_colors 1 7 3 ;; From 446926ddb46248718448c6d30b56ab28efbd5832 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 19 Dec 2016 11:56:16 +1100 Subject: [PATCH 09/12] Shell: Fix bug with sh and --version --- neofetch | 1 + 1 file changed, 1 insertion(+) diff --git a/neofetch b/neofetch index 186b9221..c4959c61 100755 --- a/neofetch +++ b/neofetch @@ -505,6 +505,7 @@ get_shell() { if [[ "$shell_version" == "on" ]]; then case "${SHELL##*/}" in "bash") shell+="${BASH_VERSION/-*}" ;; + "sh") ;; "mksh" | "ksh") shell+="$("$SHELL" -c 'printf "%s" "$KSH_VERSION"')" From d396c14f2a1015b56adc38d0c60020d3d81660dc Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 19 Dec 2016 11:58:49 +1100 Subject: [PATCH 10/12] Local IP: Fix IP address on Minix --- neofetch | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/neofetch b/neofetch index c4959c61..df8e007c 100755 --- a/neofetch +++ b/neofetch @@ -1652,11 +1652,15 @@ get_battery() { get_local_ip() { case "$os" in - "Linux" | "BSD" | "Solaris" | "MINIX") + "Linux" | "BSD" | "Solaris") local_ip="$(ip route get 1 | awk '{print $NF;exit}')" [[ -z "$local_ip" ]] && local_ip="$(ifconfig | awk '/broadcast/ {print $2}')" ;; + "MINIX") + local_ip="$(ifconfig | awk '{printf $3; exit}')" + ;; + "Mac OS X" | "iPhone OS") local_ip="$(ipconfig getifaddr en0)" [[ -z "$local_ip" ]] && local_ip="$(ipconfig getifaddr en1)" From 2942abd46bb5637e59e7c3a8522b59cac361aa84 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 19 Dec 2016 12:07:20 +1100 Subject: [PATCH 11/12] Disk: Fix disk on Minix --- neofetch | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/neofetch b/neofetch index df8e007c..0295a29b 100755 --- a/neofetch +++ b/neofetch @@ -1552,10 +1552,16 @@ get_term_font() { get_disk() { type -p df >/dev/null 2>&1 || { err "Disk requires 'df' to function. Install 'df' to get disk info."; return; } - [[ "$os" == "Haiku" ]] && { err "Disk doesn't work on Haiku due to the non-standard 'df'"; return; } + + # Get 'df' flags. + case "$os" in + "Haiku") err "Disk doesn't work on Haiku due to the non-standard 'df'"; return ;; + "Minix") df_flags=(-P -h) ;; + *) df_flags=(-h) ;; + esac # Get the info for / - disks=($(df -P -h /)) || { err "Disk: 'df' exited with error code 1"; return; } + disks=($(df "${df_flags[@]}" /)) || { err "Disk: 'df' exited with error code 1"; return; } # Put it all together disk_perc="${disks[11]/'%'}" From b3932af5016a2e7bb0d9e906f6569fcda73048c3 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 19 Dec 2016 12:08:35 +1100 Subject: [PATCH 12/12] Disk: Fix flags on Minix 2 --- neofetch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/neofetch b/neofetch index 0295a29b..dd7de0f0 100755 --- a/neofetch +++ b/neofetch @@ -1556,8 +1556,8 @@ get_disk() { # Get 'df' flags. case "$os" in "Haiku") err "Disk doesn't work on Haiku due to the non-standard 'df'"; return ;; - "Minix") df_flags=(-P -h) ;; - *) df_flags=(-h) ;; + "Minix") df_flags=(-h) ;; + *) df_flags=(-P -h) ;; esac # Get the info for /