From 4548c56ee7f95dbfb61c312b228af47d55a092b5 Mon Sep 17 00:00:00 2001 From: Ryan Hanson <13651296+rxhanson@users.noreply.github.com> Date: Wed, 7 Aug 2019 09:34:03 -0400 Subject: [PATCH] Refactored grep for macOS window manager detection Co-Authored-By: nibblonian --- neofetch | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/neofetch b/neofetch index 6a21314d..376da939 100755 --- a/neofetch +++ b/neofetch @@ -1631,7 +1631,18 @@ get_wm() { else case "$os" in "Mac OS X") - ps_line="$(ps -e | grep -o '[S]pectacle\|[A]methyst\|[k]wm\|[c]hun[k]wm\|[y]abai\|[R]ectangle')" + wm_names=( + "[S]pectacle" + "[A]methyst" + "[k]wm" + "[c]chun[k]wm" + "[y]abai" + "[R]ectangle" + ) + + regex_part=$( IFS='|'; echo "${wm_names[*]}" ) + + ps_line=$(ps -e | grep -Eio "$regex_part") case "$ps_line" in *"chunkwm"*) wm="chunkwm" ;;