Window Manager: Added support for getting window manager with xprop
This commit is contained in:
parent
c99d472ebb
commit
f0416ec78e
1
1.1.md
1
1.1.md
|
@ -31,6 +31,7 @@ at launch or in script.
|
|||
**Window Manager:**
|
||||
|
||||
- Added support for `$XINITRC`
|
||||
- Added support for `xprop`
|
||||
|
||||
**Shell:**
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ https://github.com/dylanaraps/fetch/wiki/Customizing-Info
|
|||
- **Note:** The script can now also use iTerm2's builtin image rendering instead of w3m!<br \>
|
||||
Enable it by changing `$image_backend` to `iterm2` or by using the launch flag `--image_backend`.
|
||||
- Image Cropping, Resizing etc: `ImageMagick`
|
||||
- More accurate window manager detection: `wmctrl`
|
||||
- More accurate window manager detection: `wmctrl` or `xprop`
|
||||
|
||||
**Linux / BSD:**
|
||||
|
||||
|
|
19
fetch
19
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
|
||||
# More accurate window manager detection: wmctrl or xprop
|
||||
# [ Linux / BSD ] Wallpaper Display: feh, nitrogen or gsettings
|
||||
# [ Linux / BSD ] Current Song: mpc or cmus
|
||||
# [ Linux / BSD ] Resolution detection: xorg-xdpyinfo
|
||||
|
@ -652,11 +652,25 @@ 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 [ "$XDG_CURRENT_DESKTOP" ]; then
|
||||
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//* }
|
||||
|
||||
windowmanager="$(xprop -id $wid 8s _NET_WM_NAME 2>/dev/null)"
|
||||
windowmanager=${windowmanager/*\(*\) = \"}
|
||||
windowmanager=${windowmanager/\"}
|
||||
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
|
||||
|
@ -685,6 +699,7 @@ getwindowmanager () {
|
|||
windowmanager="${windowmanager/exec }"
|
||||
windowmanager="${windowmanager/-session}"
|
||||
windowmanager="${windowmanager^}"
|
||||
fi
|
||||
}
|
||||
|
||||
# }}}
|
||||
|
|
Reference in New Issue