Merge pull request #79 from dylanaraps/xprop

Use 'xprop' instead of 'wmctrl' to get the window manager.
This commit is contained in:
Dylan Araps 2016-02-17 17:34:54 +11:00
commit ed953cdf82
3 changed files with 11 additions and 11 deletions

2
1.2.md
View File

@ -63,7 +63,7 @@ fixes issues where the wallpaper set by gsettings is an xml file.
- Added support for showing the user's DE.
**Window Manager**:
- `wmctrl` is now a required dependency. See **[#75](https://github.com/dylanaraps/fetch/issues/75)**.
- `xprop` is now a required dependency. See **[#79](https://github.com/dylanaraps/fetch/issues/79)**
- Renamed 'windowmanager' to 'wm'
**IP Address**:

View File

@ -68,13 +68,10 @@ your distro's logo or any ascii art of your choice!
### Required dependencies:
- `Bash 4.0+`
- `xprop` \[3\]
- `procps-ng`
- Not required on OS X
##### Linux / BSD
- `wmctrl` \[3\]
### Optional dependencies:
@ -93,7 +90,7 @@ your distro's logo or any ascii art of your choice!
\[2\] You can enable the `iTerm2` image backend by using the launch flag `--image_backend iterm2` or by<br \>
changing the config option `$image_backend` to `iterm2`.
\[3\] See **#75** about why this is now a required dependency.
\[3\] See **[#79](https://github.com/dylanaraps/fetch/issues/79)** about why this is now a required dependency.
\[4\] You can use the launch flag `--scrot_cmd` or change the config option `$scrot_cmd` to your screenshot<br \>
program's cmd and fetch will use it instead of scrot.

13
fetch
View File

@ -6,13 +6,12 @@
#
# Required Dependencies:
# Bash 4.0+
# Text formatting, dynamic image size and padding: tput
# xprop
# [Linux / BSD / Windows] Uptime detection: procps or procps-ng
#
# Optional Dependencies: (You'll lose these features without them)
# Displaying Images: w3m + w3m-img
# Image Cropping: ImageMagick
# 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
@ -746,9 +745,13 @@ getde () {
# Window Manager {{{
getwm () {
if type -p wmctrl >/dev/null 2>&1; then
wm="$(wmctrl -m | head -n1)"
wm=${wm/Name: }
if [ -n "$DISPLAY" ]; then
id="$(xprop -root -notype | \awk '$1=="_NET_SUPPORTING_WM_CHECK:"{print $5}')"
wm="$(xprop -id "$id" -notype -f _NET_WM_NAME 8t)"
wm=${wm/*_NET_WM_NAME = }
wm=${wm/\"}
wm=${wm/\"*}
else
case "$os" in
"Mac OS X") wm="Quartz Compositor" ;;