Merge pull request #881 from dylanaraps/wayland

wm: Better wayland detection
This commit is contained in:
Dylan Araps 2017-12-17 21:21:29 +11:00 committed by GitHub
commit e4224c4f77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 30 additions and 15 deletions

View File

@ -677,7 +677,7 @@ get_de() {
esac esac
# Fallback to using xprop. # Fallback to using xprop.
[[ -n "$DISPLAY" && -z "$de" ]] && \ [[ "$DISPLAY" && -z "$de" ]] && \
de="$(xprop -root | awk '/KDE_SESSION_VERSION|^_MUFFIN|xfce4|xfce5/')" de="$(xprop -root | awk '/KDE_SESSION_VERSION|^_MUFFIN|xfce4|xfce5/')"
# Format strings. # Format strings.
@ -703,7 +703,27 @@ get_wm() {
# If function was run, stop here. # If function was run, stop here.
((wm_run == 1)) && return ((wm_run == 1)) && return
if [[ -n "$DISPLAY" && "$os" != "Mac OS X" ]]; then if [[ "$WAYLAND_DISPLAY" ]]; then
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)" id="$(xprop -root -notype _NET_SUPPORTING_WM_CHECK)"
id="${id##* }" id="${id##* }"
wm="$(xprop -id "$id" -notype -len 100 -f _NET_WM_NAME 8t)" wm="$(xprop -id "$id" -notype -len 100 -f _NET_WM_NAME 8t)"
@ -714,13 +734,6 @@ get_wm() {
# Window Maker does not set _NET_WM_NAME # Window Maker does not set _NET_WM_NAME
[[ "$wm" =~ "WINDOWMAKER" ]] && wm="wmaker" [[ "$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 else
case "$os" in case "$os" in
"Mac OS X") "Mac OS X")
@ -736,11 +749,13 @@ get_wm() {
;; ;;
"Windows") "Windows")
wm="$(tasklist | grep -m 1 -o -F -e "bugn" \ wm="$(tasklist | grep -m 1 -o -F \
-e "bugn" \
-e "Windawesome" \ -e "Windawesome" \
-e "blackbox" \ -e "blackbox" \
-e "emerge" \ -e "emerge" \
-e "litestep")" -e "litestep")"
[[ "$wm" == "blackbox" ]] && wm="bbLean (Blackbox)" [[ "$wm" == "blackbox" ]] && wm="bbLean (Blackbox)"
wm="${wm:+$wm, }Explorer" wm="${wm:+$wm, }Explorer"
;; ;;
@ -1634,7 +1649,7 @@ get_style() {
# Fix weird output when the function is run multiple times. # Fix weird output when the function is run multiple times.
unset gtk2_theme gtk3_theme theme path 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. # Get DE if user has disabled the function.
((de_run != 1)) && get_de ((de_run != 1)) && get_de