From eac81f3b486b8d29a69635519cf47cc9c62c87cc Mon Sep 17 00:00:00 2001 From: Dylan Date: Sat, 30 Jan 2016 20:02:20 +1100 Subject: [PATCH] Revert xprop support for getwindowmanager --- 1.1.md | 1 - README.md | 2 +- fetch | 69 ++++++++++++++++++++++--------------------------------- 3 files changed, 28 insertions(+), 44 deletions(-) diff --git a/1.1.md b/1.1.md index e7e89996..1d3c4eb6 100644 --- a/1.1.md +++ b/1.1.md @@ -32,7 +32,6 @@ at launch or in script. **Window Manager:** - Added support for `$XINITRC` -- Added support for `xprop` **Shell:** diff --git a/README.md b/README.md index 1971b7a1..8e25ea65 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ your distro's logo or any ascii art of your choice! - **Note:** To enable iTerm2 mode, you need to change `$image_backend` to `iterm2` or use the launch flag `--image_backend iterm2`. - Image Cropping, Resizing etc: `ImageMagick` -- More accurate window manager detection: `wmctrl` or `xprop` +- More accurate window manager detection: `wmctrl` **Linux / BSD:** diff --git a/fetch b/fetch index 40a7b500..d04b570e 100755 --- a/fetch +++ b/fetch @@ -12,7 +12,7 @@ # Optional Dependencies: (You'll lose these features without them) # Displaying Images: w3m + w3m-img # Image Cropping: ImageMagick -# More accurate window manager detection: wmctrl or xprop +# More accurate window manager detection: wmctrl # [ Linux / BSD ] Wallpaper Display: feh, nitrogen or gsettings # [ Linux / BSD ] Current Song: mpc or cmus # [ Linux / BSD ] Resolution detection: xorg-xdpyinfo @@ -652,54 +652,39 @@ getshell () { # Window Manager {{{ getwindowmanager () { - # Check for window manager using wmctrl and xprop if type -p wmctrl >/dev/null 2>&1; then windowmanager="$(wmctrl -m | head -n1)" windowmanager=${windowmanager/Name: } - elif type -p xprop >/dev/null 2>&1; then - # Get id of window manager - wid=$(xprop -root _NET_SUPPORTING_WM_CHECK 2>/dev/null) - wid=${wid//* } + elif [ "$XDG_CURRENT_DESKTOP" ]; then + windowmanager="$XDG_CURRENT_DESKTOP" - windowmanager="$(xprop -id "$wid" 8s _NET_WM_NAME 2>/dev/null)" - windowmanager=${windowmanager/*\(*\) = \"} - windowmanager=${windowmanager/\"} + elif [ "$XINITRC" ]; then + windowmanager=$(grep "^[^#]*exec" "$XINITRC") + + elif [ -e "$HOME/.xinitrc" ]; then + windowmanager=$(grep "^[^#]*exec" "${HOME}/.xinitrc") + + else + case "$os" in + "Mac OS X") + windowmanager="Quartz Compositor" + ;; + + "Windows") + windowmanager="Explorer" + ;; + + *) + windowmanager="Unknown" + ;; + + esac fi - # If the window manager wasn't found, fallback to - # checking files / envars. - if [ -z "$windowmanager" ]; then - if [ "$XDG_CURRENT_DESKTOP" ]; then - windowmanager="$XDG_CURRENT_DESKTOP" - - elif [ "$XINITRC" ]; then - windowmanager=$(grep "^[^#]*exec" "$XINITRC") - - elif [ -e "$HOME/.xinitrc" ]; then - windowmanager=$(grep "^[^#]*exec" "${HOME}/.xinitrc") - - else - case "$os" in - "Mac OS X") - windowmanager="Quartz Compositor" - ;; - - "Windows") - windowmanager="Explorer" - ;; - - *) - windowmanager="Unknown" - ;; - - esac - fi - - windowmanager="${windowmanager/exec }" - windowmanager="${windowmanager/-session}" - windowmanager="${windowmanager^}" - fi + windowmanager="${windowmanager/exec }" + windowmanager="${windowmanager/-session}" + windowmanager="${windowmanager^}" } # }}}