Refactored grep for macOS window manager detection

Co-Authored-By: nibblonian <ted+github@rusts.net>
This commit is contained in:
Ryan Hanson 2019-08-07 09:34:03 -04:00 committed by GitHub
parent 296fb68564
commit 4548c56ee7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 1 deletions

View File

@ -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" ;;