From daf4284f7f2200bd1c278b5d207645e08907137a Mon Sep 17 00:00:00 2001 From: Andrew Titmuss Date: Fri, 18 Mar 2016 16:28:26 +1100 Subject: [PATCH 1/6] added refresh rate option for OS X --- neofetch | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/neofetch b/neofetch index cfaea51b..1597bcbb 100755 --- a/neofetch +++ b/neofetch @@ -136,6 +136,11 @@ cpu_cores="on" # --gpu_shorthand on/off/tiny gpu_shorthand="on" +# Resolution + +# Display refresh rate next to each monitor +# --refresh_rate on/off +refresh_rate="off" # Gtk Theme / Icons @@ -1273,8 +1278,16 @@ getresolution () { ;; "Mac OS X") - resolution=$(system_profiler SPDisplaysDataType |\ - awk '/Resolution:/ {printf $2"x"$4" "}') + case "$refresh_rate" in + "on") + resolution=$(system_profiler SPDisplaysDataType |\ + awk '/Resolution:/ {printf $2"x"$4" @ "$6"Hz, "}') + ;; + "off") + resolution=$(system_profiler SPDisplaysDataType |\ + awk '/Resolution:/ {printf $2"x"$4", "}') + ;; + esac ;; "Windows") @@ -1293,6 +1306,8 @@ getresolution () { resolution="Unknown" ;; esac + + resolution=${resolution%,*} } # }}} @@ -2498,6 +2513,7 @@ usage () { cat << EOF --cpu_cores on/off Whether or not to display the number of CPU cores --kernel_shorthand on/off Shorten the output of kernel --uptime_shorthand on/off Shorten the output of uptime (tiny, on, off) + --refresh_rate on/off Whether to display the refresh rate of each monitor --gpu_shorthand on/off Shorten the output of GPU (tiny, on, off) --gtk_shorthand on/off Shorten output of gtk theme/icons --gtk2 on/off Enable/Disable gtk2 theme/icons output @@ -2617,6 +2633,7 @@ while [ "$1" ]; do --uptime_shorthand) uptime_shorthand="$2" ;; --cpu_shorthand) cpu_shorthand="$2" ;; --gpu_shorthand) gpu_shorthand="$2" ;; + --refresh_rate) refresh_rate="$2" ;; --gtk_shorthand) gtk_shorthand="$2" ;; --gtk2) gtk2="$2" ;; --gtk3) gtk3="$2" ;; From 46a76f55c970d031942160f7d55e0eeb5c95d227 Mon Sep 17 00:00:00 2001 From: Andrew Titmuss Date: Fri, 18 Mar 2016 16:32:06 +1100 Subject: [PATCH 2/6] added documentation --- README.md | 1 + config/config | 6 ++++++ neofetch.1 | 3 +++ 3 files changed, 10 insertions(+) diff --git a/README.md b/README.md index 7c755561..37379f34 100644 --- a/README.md +++ b/README.md @@ -298,6 +298,7 @@ alias fetch2="fetch \ --cpu_cores on/off Whether or not to display the number of CPU cores --kernel_shorthand on/off Shorten the output of kernel --uptime_shorthand on/off Shorten the output of uptime (tiny, on, off) + --refresh_rate on/off Whether to display the refresh rate of each monitor --gpu_shorthand on/off Shorten the output of GPU (tiny, on, off) --gtk_shorthand on/off Shorten output of gtk theme/icons --gtk2 on/off Enable/Disable gtk2 theme/icons output diff --git a/config/config b/config/config index 7375e390..3a0d0e11 100644 --- a/config/config +++ b/config/config @@ -115,6 +115,12 @@ cpu_cores="on" # --gpu_shorthand on/off/tiny gpu_shorthand="on" +# Resolution + +# Display refresh rate next to each monitor +# --refresh_rate on/off +refresh_rate="off" + # Gtk Theme / Icons diff --git a/neofetch.1 b/neofetch.1 index b2132234..08bac65a 100644 --- a/neofetch.1 +++ b/neofetch.1 @@ -50,6 +50,9 @@ Shorten the output of kernel .B \--uptime_shorthand 'on/off' Shorten the output of uptime (tiny, on, off) .TP +.B \--refresh_rate 'on/off' +Whether to display the refresh rate of each monitor +.TP .B \--gpu_shorthand 'on/off' Shorten the output of GPU (tiny, on, off) .TP From b971e214e69edfb95fea5a8941fccfa893a3e1b9 Mon Sep 17 00:00:00 2001 From: Andrew Titmuss Date: Sat, 26 Mar 2016 07:59:24 +1100 Subject: [PATCH 3/6] added Linux support --- README.md | 2 +- neofetch | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 37379f34..672232c0 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,7 @@ your distro's logo or any ascii art of your choice! - Wallpaper: `feh`, `nitrogen` or `gsettings` - Current Song: `mpc` or `cmus` -- Resolution: `xorg-xdpyinfo` +- Resolution: `xorg-xdpyinfo` or `xrandr` - Screenshot: `scrot` \[5\] diff --git a/neofetch b/neofetch index 1597bcbb..8f2e06b2 100755 --- a/neofetch +++ b/neofetch @@ -1273,8 +1273,13 @@ getsong () { getresolution () { case "$os" in "Linux" | *"BSD") - type -p xdpyinfo >/dev/null 2>&1 && \ + if type -p xrandr >/dev/null 2>&1; then + resolution=$(xrandr --nograb --current | awk 'match($0,/[0-0]{2,3}.[0-9]{2}\*/) {printf $1 " @ " substr($0,RSTART,RLENGTH) "Hz, "}') + resolution=${resolution//\*} + + elif type -p xdpyinfo >/dev/null 2>&1 && \ resolution=$(xdpyinfo 2>/dev/null | awk '/dimensions:/ {printf $2}') + fi ;; "Mac OS X") From c5f22dacb327c1fd931059935839e65f1ffc8459 Mon Sep 17 00:00:00 2001 From: Andrew Titmuss Date: Sat, 26 Mar 2016 08:36:00 +1100 Subject: [PATCH 4/6] added check for whether user wants refresh rate for linux --- README.md | 2 +- neofetch | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 672232c0..37379f34 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,7 @@ your distro's logo or any ascii art of your choice! - Wallpaper: `feh`, `nitrogen` or `gsettings` - Current Song: `mpc` or `cmus` -- Resolution: `xorg-xdpyinfo` or `xrandr` +- Resolution: `xorg-xdpyinfo` - Screenshot: `scrot` \[5\] diff --git a/neofetch b/neofetch index 8f2e06b2..cbb22b62 100755 --- a/neofetch +++ b/neofetch @@ -1273,7 +1273,7 @@ getsong () { getresolution () { case "$os" in "Linux" | *"BSD") - if type -p xrandr >/dev/null 2>&1; then + if type -p xrandr >/dev/null 2>&1 && [ "$refresh_rate" == "on" ]; then resolution=$(xrandr --nograb --current | awk 'match($0,/[0-0]{2,3}.[0-9]{2}\*/) {printf $1 " @ " substr($0,RSTART,RLENGTH) "Hz, "}') resolution=${resolution//\*} From 0d64fac031a41b5c80389773c3740ab4ef9585ca Mon Sep 17 00:00:00 2001 From: Andrew Titmuss Date: Sat, 26 Mar 2016 08:51:39 +1100 Subject: [PATCH 5/6] added xrandr without refresh rate --- neofetch | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/neofetch b/neofetch index cbb22b62..6f58618d 100755 --- a/neofetch +++ b/neofetch @@ -1273,8 +1273,11 @@ getsong () { getresolution () { case "$os" in "Linux" | *"BSD") - if type -p xrandr >/dev/null 2>&1 && [ "$refresh_rate" == "on" ]; then - resolution=$(xrandr --nograb --current | awk 'match($0,/[0-0]{2,3}.[0-9]{2}\*/) {printf $1 " @ " substr($0,RSTART,RLENGTH) "Hz, "}') + if type -p xrandr >/dev/null 2>&1; then + case "$refresh_rate" in + "on") resolution=$(xrandr --nograb --current | awk 'match($0,/[0-0]{2,3}.[0-9]{2}\*/) {printf $1 " @ " substr($0,RSTART,RLENGTH) "Hz, "}') ;; + "off") resolution=$(xrandr --nograb --current | awk '/*/ {printf $1 ", "}') ;; + esac resolution=${resolution//\*} elif type -p xdpyinfo >/dev/null 2>&1 && \ From c58a95854fdba9ab917ce7f1fc66916a59594d30 Mon Sep 17 00:00:00 2001 From: Andrew Titmuss Date: Sat, 26 Mar 2016 11:34:35 +1100 Subject: [PATCH 6/6] added note about not being supported on windows --- README.md | 1 + config/config | 1 + neofetch | 2 ++ neofetch.1 | 1 + 4 files changed, 5 insertions(+) diff --git a/README.md b/README.md index 37379f34..fbc387de 100644 --- a/README.md +++ b/README.md @@ -299,6 +299,7 @@ alias fetch2="fetch \ --kernel_shorthand on/off Shorten the output of kernel --uptime_shorthand on/off Shorten the output of uptime (tiny, on, off) --refresh_rate on/off Whether to display the refresh rate of each monitor + Unsupported on Windows --gpu_shorthand on/off Shorten the output of GPU (tiny, on, off) --gtk_shorthand on/off Shorten output of gtk theme/icons --gtk2 on/off Enable/Disable gtk2 theme/icons output diff --git a/config/config b/config/config index 3a0d0e11..21a1c652 100644 --- a/config/config +++ b/config/config @@ -118,6 +118,7 @@ gpu_shorthand="on" # Resolution # Display refresh rate next to each monitor +# Unsupported on Windows # --refresh_rate on/off refresh_rate="off" diff --git a/neofetch b/neofetch index 6f58618d..0731daef 100755 --- a/neofetch +++ b/neofetch @@ -139,6 +139,7 @@ gpu_shorthand="on" # Resolution # Display refresh rate next to each monitor +# Unsupported on Windows # --refresh_rate on/off refresh_rate="off" @@ -2522,6 +2523,7 @@ usage () { cat << EOF --kernel_shorthand on/off Shorten the output of kernel --uptime_shorthand on/off Shorten the output of uptime (tiny, on, off) --refresh_rate on/off Whether to display the refresh rate of each monitor + Unsupported on Windows --gpu_shorthand on/off Shorten the output of GPU (tiny, on, off) --gtk_shorthand on/off Shorten output of gtk theme/icons --gtk2 on/off Enable/Disable gtk2 theme/icons output diff --git a/neofetch.1 b/neofetch.1 index 08bac65a..dc0a18a0 100644 --- a/neofetch.1 +++ b/neofetch.1 @@ -52,6 +52,7 @@ Shorten the output of uptime (tiny, on, off) .TP .B \--refresh_rate 'on/off' Whether to display the refresh rate of each monitor +Unsupported on Windows .TP .B \--gpu_shorthand 'on/off' Shorten the output of GPU (tiny, on, off)