wm: Better wayland detection

This commit is contained in:
dylan araps 2017-12-17 20:43:41 +11:00
parent 80a34bdf28
commit 9ad9d4d75e
1 changed files with 26 additions and 10 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,30 @@ 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
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="$(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 +737,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")
@ -1634,7 +1650,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