From 1bd185874c3afde2f485ec51850da3a5f32e06ef Mon Sep 17 00:00:00 2001 From: Jorge Gonzalez Date: Tue, 21 Mar 2017 13:45:23 -0400 Subject: [PATCH 1/3] WM: Add support for Amethyst on macOS --- neofetch | 1 + 1 file changed, 1 insertion(+) diff --git a/neofetch b/neofetch index 9b5a23d9..60f6c7b2 100755 --- a/neofetch +++ b/neofetch @@ -638,6 +638,7 @@ get_wm() { "Mac OS X") wm="Quartz Compositor" ps -e | grep -q '[S]pectacle' && wm='Spectacle' + ps -e | grep -q "[A]methyst" && wm="Amethyst" ps -e | grep -q "[k]wm" && wm="Kwm" ;; From 0c4d4eb23aeb6168410d8a2134bb626c43613ede Mon Sep 17 00:00:00 2001 From: Jorge Gonzalez Date: Tue, 21 Mar 2017 18:37:41 -0400 Subject: [PATCH 2/3] Reduce macOS WM detections to one ps call --- neofetch | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/neofetch b/neofetch index 60f6c7b2..79c9e71c 100755 --- a/neofetch +++ b/neofetch @@ -636,10 +636,17 @@ get_wm() { else case "$os" in "Mac OS X") - wm="Quartz Compositor" - ps -e | grep -q '[S]pectacle' && wm='Spectacle' - ps -e | grep -q "[A]methyst" && wm="Amethyst" - ps -e | grep -q "[k]wm" && wm="Kwm" + ps_line="$(ps -e | grep -o '[S]pectacle\|[A]methyst\|[k]wm')" + + if echo "$ps_line" | grep -q "kwm"; then + wm="Kwm" + elif echo "$ps_line" | grep -q "Amethyst"; then + wm="Amethyst" + elif echo "$ps_line" | grep -q "Spectacle"; then + wm="Spectacle" + else + wm="Quartz Compositor" + fi ;; "Windows") From 6803b571b7ffaed77b3153133d36e883e0d9177b Mon Sep 17 00:00:00 2001 From: Jorge Gonzalez Date: Tue, 21 Mar 2017 19:58:47 -0400 Subject: [PATCH 3/3] Change if statement to a switch --- neofetch | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/neofetch b/neofetch index 79c9e71c..0431b52f 100755 --- a/neofetch +++ b/neofetch @@ -638,15 +638,12 @@ get_wm() { "Mac OS X") ps_line="$(ps -e | grep -o '[S]pectacle\|[A]methyst\|[k]wm')" - if echo "$ps_line" | grep -q "kwm"; then - wm="Kwm" - elif echo "$ps_line" | grep -q "Amethyst"; then - wm="Amethyst" - elif echo "$ps_line" | grep -q "Spectacle"; then - wm="Spectacle" - else - wm="Quartz Compositor" - fi + case "$ps_line" in + *"kwm"*) wm="Kwm" ;; + *"Amethyst"*) wm="Amethyst" ;; + *"Spectacle"*) wm="Spectacle" ;; + *) wm="Quartz Compositor" ;; + esac ;; "Windows")