diff --git a/1.2.md b/1.2.md index 306343ab..fffcb4a1 100644 --- a/1.2.md +++ b/1.2.md @@ -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**: diff --git a/README.md b/README.md index 3cf3b2ae..2c13943e 100644 --- a/README.md +++ b/README.md @@ -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
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
program's cmd and fetch will use it instead of scrot. diff --git a/fetch b/fetch index d1dc44ea..9c9b09a1 100755 --- a/fetch +++ b/fetch @@ -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" ;;