From 7afcf2f2ec755bde295f5a8f3184215ace961bb3 Mon Sep 17 00:00:00 2001 From: dylan araps Date: Mon, 4 Jan 2016 16:24:41 +1100 Subject: [PATCH] Added wmctrl as a fallback for window manager detection. --- fetch.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fetch.sh b/fetch.sh index 71078056..f00c08dd 100755 --- a/fetch.sh +++ b/fetch.sh @@ -357,8 +357,11 @@ getshell () { # Get window manager getwindowmanager () { - if [ ! -z "${XDG_CURRENT_DESKTOP}" ]; then - windowmanager="${XDG_CURRENT_DESKTOP}" + if [ ! -z "$XDG_CURRENT_DESKTOP" ]; then + 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 xinitrc=$(awk '/^[^#]*exec/ {print $2}' "${HOME}/.xinitrc") windowmanager="${xinitrc/-session/}"