wm: handle non-matches

This commit is contained in:
Dylan Araps 2019-10-02 15:36:09 +03:00
parent d8d8899ad2
commit c94e2c5d9d

13
pfetch
View File

@ -765,8 +765,17 @@ get_wm() {
# To extract the name, everything before '_NET_WM_NAME = \"'
# is removed and everything after the next '"' is removed.
wm=$(xprop -id "$id" -notype -len 25 -f _NET_WM_NAME 8t)
wm=${wm##*_NET_WM_NAME = \"}
wm=${wm%%\"*}
# Handle cases of a window manager _not_ populating the
# '_NET_WM_NAME' atom. Display nothing in this case.
case $wm in
*'_NET_WM_NAME = '*)
wm=${wm##*_NET_WM_NAME = \"}
wm=${wm%%\"*}
;;
*) wm= ;;
esac
}
;;
esac