From 9ad9d4d75e368736649ef45d3ffbe68c4eaa6033 Mon Sep 17 00:00:00 2001 From: dylan araps Date: Sun, 17 Dec 2017 20:43:41 +1100 Subject: [PATCH 1/2] wm: Better wayland detection --- neofetch | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/neofetch b/neofetch index 1724d6c3..7fb09fd9 100755 --- a/neofetch +++ b/neofetch @@ -677,7 +677,7 @@ get_de() { esac # Fallback to using xprop. - [[ -n "$DISPLAY" && -z "$de" ]] && \ + [[ "$DISPLAY" && -z "$de" ]] && \ de="$(xprop -root | awk '/KDE_SESSION_VERSION|^_MUFFIN|xfce4|xfce5/')" # Format strings. @@ -703,7 +703,30 @@ get_wm() { # If function was run, stop here. ((wm_run == 1)) && return - if [[ -n "$DISPLAY" && "$os" != "Mac OS X" ]]; then + if [[ "$WAYLAND_DISPLAY" ]]; then + if [[ "$SWAYSOCK" ]]; then + wm="sway" + + else + wm="$(ps -e | grep -m 1 -o -F -e "asc" \ + -e "fireplace" \ + -e "grefsen" \ + -e "mazecompositor" \ + -e "maynard" \ + -e "motorcar" \ + -e "orbment" \ + -e "orbital" \ + -e "perceptia" \ + -e "rustland" \ + -e "velox" \ + -e "wavy" \ + -e "wayhouse" \ + -e "way-cooler" \ + -e "westford" \ + -e "weston")" + fi + + elif [[ "$DISPLAY" && "$os" != "Mac OS X" ]]; then id="$(xprop -root -notype _NET_SUPPORTING_WM_CHECK)" id="${id##* }" wm="$(xprop -id "$id" -notype -len 100 -f _NET_WM_NAME 8t)" @@ -714,13 +737,6 @@ get_wm() { # Window Maker does not set _NET_WM_NAME [[ "$wm" =~ "WINDOWMAKER" ]] && wm="wmaker" - # Fallback for Wayland wms. - [[ "$wm" == "xwlc" ]] && \ - wm="$(ps -e | grep -m 1 -o -F -e "sway" \ - -e "orbment" \ - -e "orbital" \ - -e "way-cooler")" - else case "$os" in "Mac OS X") @@ -1634,7 +1650,7 @@ get_style() { # Fix weird output when the function is run multiple times. unset gtk2_theme gtk3_theme theme path - if [[ -n "$DISPLAY" && "$os" != "Mac OS X" ]]; then + if [[ "$DISPLAY" && "$os" != "Mac OS X" ]]; then # Get DE if user has disabled the function. ((de_run != 1)) && get_de From 4870a863ac3c3f2ab818eb38b44bb23cc3a03935 Mon Sep 17 00:00:00 2001 From: dylan araps Date: Sun, 17 Dec 2017 21:10:48 +1100 Subject: [PATCH 2/2] wm: cleanup --- neofetch | 51 +++++++++++++++++++++++++-------------------------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/neofetch b/neofetch index 7fb09fd9..05c441cd 100755 --- a/neofetch +++ b/neofetch @@ -704,27 +704,24 @@ get_wm() { ((wm_run == 1)) && return if [[ "$WAYLAND_DISPLAY" ]]; then - if [[ "$SWAYSOCK" ]]; then - wm="sway" - - else - wm="$(ps -e | grep -m 1 -o -F -e "asc" \ - -e "fireplace" \ - -e "grefsen" \ - -e "mazecompositor" \ - -e "maynard" \ - -e "motorcar" \ - -e "orbment" \ - -e "orbital" \ - -e "perceptia" \ - -e "rustland" \ - -e "velox" \ - -e "wavy" \ - -e "wayhouse" \ - -e "way-cooler" \ - -e "westford" \ - -e "weston")" - fi + wm="$(ps -e | grep -m 1 -o -F \ + -e "asc" \ + -e "fireplace" \ + -e "grefsen" \ + -e "mazecompositor" \ + -e "maynard" \ + -e "motorcar" \ + -e "orbment" \ + -e "orbital" \ + -e "perceptia" \ + -e "rustland" \ + -e "sway" \ + -e "velox" \ + -e "wavy" \ + -e "wayhouse" \ + -e "way-cooler" \ + -e "westford" \ + -e "weston")" elif [[ "$DISPLAY" && "$os" != "Mac OS X" ]]; then id="$(xprop -root -notype _NET_SUPPORTING_WM_CHECK)" @@ -752,11 +749,13 @@ get_wm() { ;; "Windows") - wm="$(tasklist | grep -m 1 -o -F -e "bugn" \ - -e "Windawesome" \ - -e "blackbox" \ - -e "emerge" \ - -e "litestep")" + wm="$(tasklist | grep -m 1 -o -F \ + -e "bugn" \ + -e "Windawesome" \ + -e "blackbox" \ + -e "emerge" \ + -e "litestep")" + [[ "$wm" == "blackbox" ]] && wm="bbLean (Blackbox)" wm="${wm:+$wm, }Explorer" ;;