wm: Fix issues. Related to #48
This commit is contained in:
parent
c8aca296c1
commit
44aaae774f
44
pfetch
44
pfetch
|
@ -845,6 +845,7 @@ get_wm() {
|
||||||
# To extract the name, everything before '_NET_WM_NAME = \"'
|
# To extract the name, everything before '_NET_WM_NAME = \"'
|
||||||
# is removed and everything after the next '"' is removed.
|
# is removed and everything after the next '"' is removed.
|
||||||
wm=$(xprop -id "$id" -notype -len 25 -f _NET_WM_NAME 8t)
|
wm=$(xprop -id "$id" -notype -len 25 -f _NET_WM_NAME 8t)
|
||||||
|
}
|
||||||
|
|
||||||
# Handle cases of a window manager _not_ populating the
|
# Handle cases of a window manager _not_ populating the
|
||||||
# '_NET_WM_NAME' atom. Display nothing in this case.
|
# '_NET_WM_NAME' atom. Display nothing in this case.
|
||||||
|
@ -858,38 +859,21 @@ get_wm() {
|
||||||
# Fallback to checking the process list
|
# Fallback to checking the process list
|
||||||
# for the select few window managers which
|
# for the select few window managers which
|
||||||
# don't set '_NET_WM_NAME'.
|
# don't set '_NET_WM_NAME'.
|
||||||
#
|
while read -r ps_line; do
|
||||||
# TODO: This is currently limited to 'grep'
|
case $ps_line in
|
||||||
# implementations providing the '-o'
|
*catwm*) wm=catwm ;;
|
||||||
# flag. This needs to be replaced with
|
*fvwm*) wm=fvwm ;;
|
||||||
# a command which searches for a list
|
*dwm*) wm=dwm ;;
|
||||||
# of strings and returns _only_ the
|
*2bwm*) wm=2bwm ;;
|
||||||
# first match's contents (also ensuring
|
*monsterwm*) wm=monsterwm ;;
|
||||||
# the search itself isn't matched).
|
*wmaker*) wm='Window Maker' ;;
|
||||||
#
|
*sowm*) wm=sowm ;;
|
||||||
# A generic parser isn't possible as
|
esac
|
||||||
# the output of 'ps' is _not_ the same
|
done <<-EOF
|
||||||
# between implementations and across
|
$(ps x)
|
||||||
# operating systems.
|
EOF
|
||||||
#
|
|
||||||
# The simple search method above works
|
|
||||||
# regardless of 'ps' implementation.
|
|
||||||
#
|
|
||||||
# Disable the shellcheck warning about using
|
|
||||||
# 'pgrep' instead of 'ps | grep' as 'pgrep'
|
|
||||||
# is not always available.
|
|
||||||
# shellcheck disable=2009
|
|
||||||
wm=$(ps x | grep -o \
|
|
||||||
-e '[c]atwm' \
|
|
||||||
-e '[f]vwm' \
|
|
||||||
-e '[d]wm' \
|
|
||||||
-e '[2]bwm' \
|
|
||||||
-e '[m]onsterwm' \
|
|
||||||
-e '[w]maker' \
|
|
||||||
-e '[s]owm')
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user