Added wmctrl as a fallback for window manager detection.

This commit is contained in:
dylan araps 2016-01-04 16:24:41 +11:00
parent 25941af61b
commit 7afcf2f2ec
1 changed files with 5 additions and 2 deletions

View File

@ -357,8 +357,11 @@ getshell () {
# Get window manager # Get window manager
getwindowmanager () { getwindowmanager () {
if [ ! -z "${XDG_CURRENT_DESKTOP}" ]; then if [ ! -z "$XDG_CURRENT_DESKTOP" ]; then
windowmanager="${XDG_CURRENT_DESKTOP}" windowmanager="$XDG_CURRENT_DESKTOP"
elif type -p wmctrl >/dev/null 2>&1; then
windowmanager="$(wmctrl -m | head -n1)"
windowmanager=${windowmanager/Name: /}
elif [ -e "$HOME/.xinitrc" ]; then elif [ -e "$HOME/.xinitrc" ]; then
xinitrc=$(awk '/^[^#]*exec/ {print $2}' "${HOME}/.xinitrc") xinitrc=$(awk '/^[^#]*exec/ {print $2}' "${HOME}/.xinitrc")
windowmanager="${xinitrc/-session/}" windowmanager="${xinitrc/-session/}"