power: optimize kernel timers, GPU devfreq, conky, and D-Bus monitors for battery life
This commit is contained in:
1 parent
5da053d8a5
commit
e42eb573ed
7 files changed
+900
-885
No files matched your search
@@ -0,0 +1,5 @@
|
||||
[logging]
|
||||
level=ERR
|
||||
|
||||
[connection]
|
||||
wifi.powersave=3
|
||||
@@ -1,4 +1,4 @@
|
||||
# /etc/conf.d/modemmanager: config file for modemmanager
|
||||
|
||||
# Enable quick suspend/resume hooks and debug mode (allows mmcli --command AT queries)
|
||||
modemmanager_opts="--test-quick-suspend-resume --debug"
|
||||
# Enable quick suspend/resume hooks with minimal logging to save power
|
||||
modemmanager_opts="--test-quick-suspend-resume --log-level=ERR"
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
# Bananarchy kernel and runtime power management optimizations
|
||||
|
||||
# Disable fbcon cursor blinking (eliminates 5 Hz fb_flashcursor + drm_fb_helper_damage_work wakeups)
|
||||
if [ -w /sys/class/graphics/fbcon/cursor_blink ]; then
|
||||
echo 0 > /sys/class/graphics/fbcon/cursor_blink 2>/dev/null || true
|
||||
fi
|
||||
|
||||
# Reduce periodic VM stat shepherd and dirty writeback timer wakeups
|
||||
{ echo 10 > /proc/sys/vm/stat_interval; } 2>/dev/null || true
|
||||
{ echo 1500 > /proc/sys/vm/dirty_writeback_centisecs; } 2>/dev/null || true
|
||||
{ echo 3000 > /proc/sys/vm/dirty_expire_centisecs; } 2>/dev/null || true
|
||||
{ echo "1 4 1 4" > /proc/sys/kernel/printk; } 2>/dev/null || true
|
||||
|
||||
@@ -17,7 +17,7 @@ conky.config = {
|
||||
draw_shades = true,
|
||||
font = 'Fira Code:size=14:style=Regular',
|
||||
use_xft = true,
|
||||
update_interval = 15,
|
||||
update_interval = 30,
|
||||
}
|
||||
|
||||
conky.text = [[${alignc}${font Fira Code:size=32:style=Regular}${time %H:%M}${font}
|
||||
|
||||
@@ -67,78 +67,61 @@ mainloop() {
|
||||
while : ; do
|
||||
uim_st="$(doas -n /usr/libexec/msm-modem-uim-selection status 2>/dev/null || /usr/libexec/msm-modem-uim-selection status 2>/dev/null || true)"
|
||||
if printf "%s\n" "$uim_st" | grep -q "^DUAL_SIM_ACTIVE=1$"; then
|
||||
# Run the daemon as root whenever doas permits it. Only fall back to
|
||||
# an unprivileged instance when doas is unavailable, not when the root
|
||||
# daemon merely exited or was restarted (an unprivileged instance
|
||||
# cannot keep the user's call log and call state files writable).
|
||||
if doas -n /usr/libexec/msm-modem-uim-selection status >/dev/null 2>&1; then
|
||||
doas -n /usr/libexec/msm-modem-uim-selection dsds-daemon 2>/dev/null || true
|
||||
else
|
||||
/usr/libexec/msm-modem-uim-selection dsds-daemon 2>/dev/null || true
|
||||
fi
|
||||
sleep 5
|
||||
else
|
||||
sleep 30
|
||||
fi
|
||||
sleep 5
|
||||
done
|
||||
) &
|
||||
|
||||
# Monitor for incoming calls
|
||||
dbus-monitor --system "interface='org.freedesktop.ModemManager1.Modem.Voice',type='signal',member='CallAdded'" |
|
||||
while read -r line; do
|
||||
echo "$line" | grep -qE "^signal" && sxmo_modem.sh checkforincomingcalls
|
||||
done &
|
||||
|
||||
# Monitor for incoming texts
|
||||
dbus-monitor --system "interface='org.freedesktop.ModemManager1.Modem.Messaging',type='signal',member='Added'" |
|
||||
while read -r line; do
|
||||
echo "$line" | grep -qE "^signal" && sxmo_modem.sh checkfornewtexts
|
||||
done &
|
||||
|
||||
# Monitor for finished calls
|
||||
dbus-monitor --system "interface='org.freedesktop.DBus.Properties',member='PropertiesChanged',arg0='org.freedesktop.ModemManager1.Call'" |
|
||||
while read -r line; do
|
||||
echo "$line" | grep -qE "^signal" && sxmo_modem.sh checkforfinishedcalls
|
||||
done &
|
||||
|
||||
# Monitor for modem state change
|
||||
dbus-monitor --system "interface='org.freedesktop.ModemManager1.Modem',type='signal',member='StateChanged'" |
|
||||
while read -r line; do
|
||||
if echo "$line" | grep -qE "^signal.*StateChanged"; then
|
||||
read -r oldstate
|
||||
read -r newstate
|
||||
read -r reason
|
||||
sxmo_hook_modem.sh "$(statenumtoname "$oldstate")" \
|
||||
"$(statenumtoname "$newstate")" \
|
||||
"$(echo "$reason" | sed 's/uint32 //')"
|
||||
sxmo_hook_statusbar.sh modem
|
||||
fi
|
||||
done &
|
||||
|
||||
# Monitor for 3GPP USSD
|
||||
dbus-monitor --system "interface='org.freedesktop.DBus.Properties',member='PropertiesChanged',arg0='org.freedesktop.ModemManager1.Modem.Modem3gpp.Ussd'" |
|
||||
# Monitor ModemManager signals using a single dbus-monitor connection
|
||||
dbus-monitor --system \
|
||||
"interface='org.freedesktop.ModemManager1.Modem.Voice',type='signal',member='CallAdded'" \
|
||||
"interface='org.freedesktop.ModemManager1.Modem.Messaging',type='signal',member='Added'" \
|
||||
"interface='org.freedesktop.DBus.Properties',member='PropertiesChanged',arg0='org.freedesktop.ModemManager1.Sms'" \
|
||||
"interface='org.freedesktop.DBus.Properties',member='PropertiesChanged',arg0='org.freedesktop.ModemManager1.Call'" \
|
||||
"interface='org.freedesktop.ModemManager1.Modem',type='signal',member='StateChanged'" \
|
||||
"interface='org.freedesktop.DBus.Properties',member='PropertiesChanged',arg0='org.freedesktop.ModemManager1.Modem.Modem3gpp.Ussd'" |
|
||||
while read -r line; do
|
||||
case "$line" in
|
||||
*"/org/freedesktop/ModemManager1/Modem"*)
|
||||
MODEM=$(echo "$line" | awk -F'[;=]' '{print $6}')
|
||||
CHANGED=0
|
||||
signal*"interface=org.freedesktop.ModemManager1.Modem.Voice"*"member=CallAdded"*)
|
||||
sxmo_modem.sh checkforincomingcalls &
|
||||
;;
|
||||
*"string \"NetworkNotification"*)
|
||||
TYPE="NetworkNotification"
|
||||
CHANGED=1
|
||||
signal*"interface=org.freedesktop.ModemManager1.Modem.Messaging"*"member=Added"*)
|
||||
sxmo_modem.sh checkfornewtexts &
|
||||
;;
|
||||
*"string \"NetworkRequest"*)
|
||||
TYPE="NetworkRequest"
|
||||
CHANGED=1
|
||||
signal*"path=/org/freedesktop/ModemManager1/SMS/"*"member=PropertiesChanged"*)
|
||||
sxmo_modem.sh checkfornewtexts &
|
||||
;;
|
||||
*)
|
||||
CHANGED=0
|
||||
signal*"path=/org/freedesktop/ModemManager1/Call/"*"member=PropertiesChanged"*)
|
||||
sxmo_modem.sh checkforfinishedcalls &
|
||||
;;
|
||||
signal*"interface=org.freedesktop.ModemManager1.Modem;"*"member=StateChanged"*)
|
||||
read -r oldstate || true
|
||||
read -r newstate || true
|
||||
read -r reason || true
|
||||
(
|
||||
sxmo_hook_modem.sh "$(statenumtoname "$oldstate")" \
|
||||
"$(statenumtoname "$newstate")" \
|
||||
"$(echo "$reason" | sed 's/uint32 //')"
|
||||
sxmo_hook_statusbar.sh modem
|
||||
) &
|
||||
;;
|
||||
signal*"path=/org/freedesktop/ModemManager1/Modem/"*"member=PropertiesChanged"*)
|
||||
MODEM="$(echo "$line" | awk -F'[;=]' '{print $6}')"
|
||||
;;
|
||||
*"string \"NetworkNotification\""*)
|
||||
[ -n "${MODEM:-}" ] && sxmo_ussd.sh "$MODEM" "NetworkNotification" "" &
|
||||
;;
|
||||
*"string \"NetworkRequest\""*)
|
||||
[ -n "${MODEM:-}" ] && sxmo_ussd.sh "$MODEM" "NetworkRequest" "" &
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "$CHANGED" = "1" ]; then
|
||||
# Handle unsolicited USSD in background without spawning a terminal window
|
||||
sxmo_ussd.sh "$MODEM" "$TYPE" "" &
|
||||
fi
|
||||
|
||||
done &
|
||||
|
||||
if [ -f "${SXMO_MMS_BASE_DIR:-"$HOME"/.mms/modemmanager}/mms" ]; then
|
||||
|
||||
+362
-362
@@ -11,566 +11,566 @@ export DISPLAY="${DISPLAY:-:0}"
|
||||
export SXMO_WM="${SXMO_WM:-dwm}"
|
||||
|
||||
_dwm_prep() {
|
||||
if [ -z "$DISPLAY" ]; then
|
||||
export DISPLAY=:0
|
||||
fi
|
||||
if [ -e /tmp/dwm_plugin_dmenu.active ] && [ -p /tmp/dwm_plugin_dmenu.fifo ]; then
|
||||
printf "CLOSE\n" > /tmp/dwm_plugin_dmenu.fifo 2>/dev/null || true
|
||||
sleep 0.04
|
||||
fi
|
||||
if [ -z "$DISPLAY" ]; then
|
||||
export DISPLAY=:0
|
||||
fi
|
||||
if [ -e /tmp/dwm_plugin_dmenu.active ] && [ -p /tmp/dwm_plugin_dmenu.fifo ]; then
|
||||
printf "CLOSE\n" > /tmp/dwm_plugin_dmenu.fifo 2>/dev/null || true
|
||||
sleep 0.04
|
||||
fi
|
||||
}
|
||||
|
||||
swi3msg() {
|
||||
case "$SXMO_WM" in
|
||||
sway) swaymsg "$@" ;;
|
||||
i3) i3-msg "$@" ;;
|
||||
esac
|
||||
case "$SXMO_WM" in
|
||||
sway) swaymsg "$@" ;;
|
||||
i3) i3-msg "$@" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Output Power Management {{{
|
||||
xorgdisplay() {
|
||||
case "$1" in
|
||||
off)
|
||||
if [ -r /sys/class/backlight/backlight/brightness ]; then
|
||||
_cur_bl=0
|
||||
read -r _cur_bl < /sys/class/backlight/backlight/brightness 2>/dev/null || true
|
||||
if [ "${_cur_bl:-0}" -ge 1 ] 2>/dev/null; then
|
||||
printf '%s\n' "$_cur_bl" > /tmp/sxmo_saved_brightness 2>/dev/null || true
|
||||
mkdir -p "${XDG_CONFIG_HOME:-$HOME/.config}/sxmo" 2>/dev/null || true
|
||||
printf '%s\n' "$_cur_bl" > "${XDG_CONFIG_HOME:-$HOME/.config}/sxmo/brightness" 2>/dev/null || true
|
||||
fi
|
||||
fi
|
||||
if [ -w /sys/class/leds/white:kbd_backlight/brightness ]; then
|
||||
printf '0\n' > /sys/class/leds/white:kbd_backlight/brightness 2>/dev/null || true
|
||||
fi
|
||||
if [ -w /sys/class/backlight/backlight/brightness ]; then
|
||||
printf '0\n' > /sys/class/backlight/backlight/brightness 2>/dev/null || true
|
||||
fi
|
||||
xset s off s noblank >/dev/null 2>&1 || true
|
||||
;;
|
||||
on)
|
||||
xset s off s noblank >/dev/null 2>&1 || true
|
||||
if [ -w /sys/class/backlight/backlight/bl_power ]; then
|
||||
printf '0\n' > /sys/class/backlight/backlight/bl_power 2>/dev/null || true
|
||||
fi
|
||||
if [ -w /sys/class/backlight/backlight/brightness ]; then
|
||||
_restore_bl=""
|
||||
if [ -r /tmp/sxmo_saved_brightness ]; then
|
||||
read -r _restore_bl < /tmp/sxmo_saved_brightness 2>/dev/null || true
|
||||
fi
|
||||
if [ -z "$_restore_bl" ] || [ "${_restore_bl:-0}" -lt 1 ] 2>/dev/null; then
|
||||
if [ -r "${XDG_CONFIG_HOME:-$HOME/.config}/sxmo/brightness" ]; then
|
||||
read -r _restore_bl < "${XDG_CONFIG_HOME:-$HOME/.config}/sxmo/brightness" 2>/dev/null || true
|
||||
fi
|
||||
fi
|
||||
if [ -z "$_restore_bl" ] || [ "${_restore_bl:-0}" -lt 1 ] 2>/dev/null; then
|
||||
_restore_bl=14
|
||||
read -r _restore_bl < /sys/class/backlight/backlight/max_brightness 2>/dev/null || true
|
||||
fi
|
||||
printf '%s\n' "${_restore_bl:-14}" > /tmp/sxmo_saved_brightness 2>/dev/null || true
|
||||
printf '%s\n' "${_restore_bl:-14}" > /sys/class/backlight/backlight/brightness 2>/dev/null || true
|
||||
fi
|
||||
if [ -w /sys/class/leds/white:kbd_backlight/brightness ]; then
|
||||
_restore_kbd="255"
|
||||
if [ -r /tmp/sxmo_saved_kbd_brightness ]; then
|
||||
read -r _restore_kbd < /tmp/sxmo_saved_kbd_brightness 2>/dev/null || true
|
||||
elif [ -r "${XDG_CONFIG_HOME:-$HOME/.config}/sxmo/kbd_brightness" ]; then
|
||||
read -r _restore_kbd < "${XDG_CONFIG_HOME:-$HOME/.config}/sxmo/kbd_brightness" 2>/dev/null || true
|
||||
fi
|
||||
printf '%s\n' "${_restore_kbd:-255}" > /sys/class/leds/white:kbd_backlight/brightness 2>/dev/null || true
|
||||
fi
|
||||
;;
|
||||
"")
|
||||
_cur_bl=14
|
||||
if [ -r /sys/class/backlight/backlight/brightness ]; then
|
||||
read -r _cur_bl < /sys/class/backlight/backlight/brightness 2>/dev/null || _cur_bl=14
|
||||
fi
|
||||
if [ "${_cur_bl:-0}" -le 0 ] 2>/dev/null; then
|
||||
printf "off\n"
|
||||
else
|
||||
printf "on\n"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
printf 'sxmo_wm.sh display: unknown command "%s"\n' "$1" >&2
|
||||
printf 'Usage: sxmo_wm.sh display [on|off]\n' >&2
|
||||
;;
|
||||
esac
|
||||
case "$1" in
|
||||
off)
|
||||
if [ -r /sys/class/backlight/backlight/brightness ]; then
|
||||
_cur_bl=0
|
||||
read -r _cur_bl < /sys/class/backlight/backlight/brightness 2>/dev/null || true
|
||||
if [ "${_cur_bl:-0}" -ge 1 ] 2>/dev/null; then
|
||||
printf '%s\n' "$_cur_bl" > /tmp/sxmo_saved_brightness 2>/dev/null || true
|
||||
mkdir -p "${XDG_CONFIG_HOME:-$HOME/.config}/sxmo" 2>/dev/null || true
|
||||
printf '%s\n' "$_cur_bl" > "${XDG_CONFIG_HOME:-$HOME/.config}/sxmo/brightness" 2>/dev/null || true
|
||||
fi
|
||||
fi
|
||||
if [ -w /sys/class/leds/white:kbd_backlight/brightness ]; then
|
||||
printf '0\n' > /sys/class/leds/white:kbd_backlight/brightness 2>/dev/null || true
|
||||
fi
|
||||
if [ -w /sys/class/backlight/backlight/brightness ]; then
|
||||
printf '0\n' > /sys/class/backlight/backlight/brightness 2>/dev/null || true
|
||||
fi
|
||||
xset s off s noblank >/dev/null 2>&1 || true
|
||||
;;
|
||||
on)
|
||||
xset s off s noblank >/dev/null 2>&1 || true
|
||||
if [ -w /sys/class/backlight/backlight/bl_power ]; then
|
||||
printf '0\n' > /sys/class/backlight/backlight/bl_power 2>/dev/null || true
|
||||
fi
|
||||
if [ -w /sys/class/backlight/backlight/brightness ]; then
|
||||
_restore_bl=""
|
||||
if [ -r /tmp/sxmo_saved_brightness ]; then
|
||||
read -r _restore_bl < /tmp/sxmo_saved_brightness 2>/dev/null || true
|
||||
fi
|
||||
if [ -z "$_restore_bl" ] || [ "${_restore_bl:-0}" -lt 1 ] 2>/dev/null; then
|
||||
if [ -r "${XDG_CONFIG_HOME:-$HOME/.config}/sxmo/brightness" ]; then
|
||||
read -r _restore_bl < "${XDG_CONFIG_HOME:-$HOME/.config}/sxmo/brightness" 2>/dev/null || true
|
||||
fi
|
||||
fi
|
||||
if [ -z "$_restore_bl" ] || [ "${_restore_bl:-0}" -lt 1 ] 2>/dev/null; then
|
||||
_restore_bl=14
|
||||
read -r _restore_bl < /sys/class/backlight/backlight/max_brightness 2>/dev/null || true
|
||||
fi
|
||||
printf '%s\n' "${_restore_bl:-14}" > /tmp/sxmo_saved_brightness 2>/dev/null || true
|
||||
printf '%s\n' "${_restore_bl:-14}" > /sys/class/backlight/backlight/brightness 2>/dev/null || true
|
||||
fi
|
||||
if [ -w /sys/class/leds/white:kbd_backlight/brightness ]; then
|
||||
_restore_kbd="255"
|
||||
if [ -r /tmp/sxmo_saved_kbd_brightness ]; then
|
||||
read -r _restore_kbd < /tmp/sxmo_saved_kbd_brightness 2>/dev/null || true
|
||||
elif [ -r "${XDG_CONFIG_HOME:-$HOME/.config}/sxmo/kbd_brightness" ]; then
|
||||
read -r _restore_kbd < "${XDG_CONFIG_HOME:-$HOME/.config}/sxmo/kbd_brightness" 2>/dev/null || true
|
||||
fi
|
||||
printf '%s\n' "${_restore_kbd:-255}" > /sys/class/leds/white:kbd_backlight/brightness 2>/dev/null || true
|
||||
fi
|
||||
;;
|
||||
"")
|
||||
_cur_bl=14
|
||||
if [ -r /sys/class/backlight/backlight/brightness ]; then
|
||||
read -r _cur_bl < /sys/class/backlight/backlight/brightness 2>/dev/null || _cur_bl=14
|
||||
fi
|
||||
if [ "${_cur_bl:-0}" -le 0 ] 2>/dev/null; then
|
||||
printf "off\n"
|
||||
else
|
||||
printf "on\n"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
printf 'sxmo_wm.sh display: unknown command "%s"\n' "$1" >&2
|
||||
printf 'Usage: sxmo_wm.sh display [on|off]\n' >&2
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
wldisplay() {
|
||||
case "$1" in
|
||||
on) wlopm --on "*" ;;
|
||||
off) wlopm --off "*";;
|
||||
"")
|
||||
if wlopm | grep -q "on"; then
|
||||
printf "on\n"
|
||||
else
|
||||
printf "off\n"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
printf 'sxmo_wm.sh display: unknown command "%s"\n' "$1" >&2
|
||||
printf 'Usage: sxmo_wm.sh display [on|off]\n' >&2
|
||||
;;
|
||||
esac
|
||||
case "$1" in
|
||||
on) wlopm --on "*" ;;
|
||||
off) wlopm --off "*";;
|
||||
"")
|
||||
if wlopm | grep -q "on"; then
|
||||
printf "on\n"
|
||||
else
|
||||
printf "off\n"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
printf 'sxmo_wm.sh display: unknown command "%s"\n' "$1" >&2
|
||||
printf 'Usage: sxmo_wm.sh display [on|off]\n' >&2
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
wm_generic_dpms() {
|
||||
sxmo_log "WARNING: $0: the dpms subcommand is deprecated, use display instead"
|
||||
sxmo_log "WARNING: $0: the dpms subcommand is deprecated, use display instead"
|
||||
|
||||
# The dpms command was origionally implemented with on/off being the
|
||||
# opposite of what they should have been. Swap them for backwards
|
||||
# compatability.
|
||||
case "$1" in
|
||||
on)
|
||||
shift
|
||||
set -- "off" "$@"
|
||||
;;
|
||||
off)
|
||||
shift
|
||||
set -- "on" "$@"
|
||||
;;
|
||||
esac
|
||||
# The dpms command was origionally implemented with on/off being the
|
||||
# opposite of what they should have been. Swap them for backwards
|
||||
# compatability.
|
||||
case "$1" in
|
||||
on)
|
||||
shift
|
||||
set -- "off" "$@"
|
||||
;;
|
||||
off)
|
||||
shift
|
||||
set -- "on" "$@"
|
||||
;;
|
||||
esac
|
||||
|
||||
dispatch display "$@"
|
||||
dispatch display "$@"
|
||||
}
|
||||
# }}}
|
||||
|
||||
# inputevent {{{
|
||||
xorginputevent() {
|
||||
if [ "$1" = "touchscreen" ]; then
|
||||
TOUCH_POINTER_ID="$SXMO_TOUCHSCREEN_ID"
|
||||
elif [ "$1" = "stylus" ]; then
|
||||
TOUCH_POINTER_ID="$SXMO_STYLUS_ID"
|
||||
fi
|
||||
if [ "$1" = "touchscreen" ]; then
|
||||
TOUCH_POINTER_ID="$SXMO_TOUCHSCREEN_ID"
|
||||
elif [ "$1" = "stylus" ]; then
|
||||
TOUCH_POINTER_ID="$SXMO_STYLUS_ID"
|
||||
fi
|
||||
|
||||
if [ -z "$TOUCH_POINTER_ID" ]; then
|
||||
echo "not found"
|
||||
return 0
|
||||
fi
|
||||
if [ -z "$TOUCH_POINTER_ID" ]; then
|
||||
echo "not found"
|
||||
return 0
|
||||
fi
|
||||
|
||||
STATE=off
|
||||
if xinput list-props "$TOUCH_POINTER_ID" | \
|
||||
grep "Device Enabled" | \
|
||||
grep -q "1$"; then
|
||||
STATE=on
|
||||
fi
|
||||
STATE=off
|
||||
if xinput list-props "$TOUCH_POINTER_ID" | \
|
||||
grep "Device Enabled" | \
|
||||
grep -q "1$"; then
|
||||
STATE=on
|
||||
fi
|
||||
|
||||
if [ -z "$2" ]; then
|
||||
printf %s "$STATE"
|
||||
elif [ "$2" = on ] && [ "$STATE" != on ]; then
|
||||
xinput enable "$TOUCH_POINTER_ID"
|
||||
elif [ "$2" = off ] && [ "$STATE" != off ] ; then
|
||||
xinput disable "$TOUCH_POINTER_ID"
|
||||
fi
|
||||
if [ -z "$2" ]; then
|
||||
printf %s "$STATE"
|
||||
elif [ "$2" = on ] && [ "$STATE" != on ]; then
|
||||
xinput enable "$TOUCH_POINTER_ID"
|
||||
elif [ "$2" = off ] && [ "$STATE" != off ] ; then
|
||||
xinput disable "$TOUCH_POINTER_ID"
|
||||
fi
|
||||
}
|
||||
|
||||
swayinputevent() {
|
||||
if [ "$1" = "touchscreen" ]; then
|
||||
TOUCH_POINTER_ID="touch"
|
||||
elif [ "$1" = "stylus" ]; then
|
||||
TOUCH_POINTER_ID="tablet_tool"
|
||||
fi
|
||||
if [ "$1" = "touchscreen" ]; then
|
||||
TOUCH_POINTER_ID="touch"
|
||||
elif [ "$1" = "stylus" ]; then
|
||||
TOUCH_POINTER_ID="tablet_tool"
|
||||
fi
|
||||
|
||||
# If we dont have any matching input
|
||||
if ! swaymsg -t get_inputs \
|
||||
| jq -r ".[] | select(.type == \"$TOUCH_POINTER_ID\" )" \
|
||||
| grep -q .; then
|
||||
# If we dont have any matching input
|
||||
if ! swaymsg -t get_inputs \
|
||||
| jq -r ".[] | select(.type == \"$TOUCH_POINTER_ID\" )" \
|
||||
| grep -q .; then
|
||||
|
||||
if [ -z "$2" ]; then
|
||||
printf "not found"
|
||||
exit 0
|
||||
else
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
if [ -z "$2" ]; then
|
||||
printf "not found"
|
||||
exit 0
|
||||
else
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
STATE=on
|
||||
if swaymsg -t get_inputs \
|
||||
| jq -r ".[] | select(.type == \"$TOUCH_POINTER_ID\" ) | .libinput.send_events" \
|
||||
| grep -q "disabled"; then
|
||||
STATE=off
|
||||
fi
|
||||
STATE=on
|
||||
if swaymsg -t get_inputs \
|
||||
| jq -r ".[] | select(.type == \"$TOUCH_POINTER_ID\" ) | .libinput.send_events" \
|
||||
| grep -q "disabled"; then
|
||||
STATE=off
|
||||
fi
|
||||
|
||||
if [ -z "$2" ]; then
|
||||
printf %s "$STATE"
|
||||
elif [ "$2" = on ] && [ "$STATE" != on ]; then
|
||||
swaymsg "input type:$TOUCH_POINTER_ID events enabled" > /dev/null
|
||||
elif [ "$2" = off ] && [ "$STATE" != off ] ; then
|
||||
swaymsg "input type:$TOUCH_POINTER_ID events disabled" > /dev/null
|
||||
fi
|
||||
if [ -z "$2" ]; then
|
||||
printf %s "$STATE"
|
||||
elif [ "$2" = on ] && [ "$STATE" != on ]; then
|
||||
swaymsg "input type:$TOUCH_POINTER_ID events enabled" > /dev/null
|
||||
elif [ "$2" = off ] && [ "$STATE" != off ] ; then
|
||||
swaymsg "input type:$TOUCH_POINTER_ID events disabled" > /dev/null
|
||||
fi
|
||||
}
|
||||
# }}}
|
||||
|
||||
# focusedwindow {{{
|
||||
_xorgfocusedwindow() {
|
||||
xprop -id "$(xdotool getactivewindow 2>/dev/null)" 2>/dev/null | awk '
|
||||
/^WM_CLASS/ {
|
||||
sub(/^WM_CLASS[^=]*= ?"[^"]*", "/, "")
|
||||
sub(/"$/, "")
|
||||
class = $0
|
||||
}
|
||||
/^WM_NAME/ {
|
||||
sub(/^WM_NAME[^=]*= ?"/, "")
|
||||
sub(/"$/, "")
|
||||
title = $0
|
||||
}
|
||||
END { printf "%s\n%s\n", tolower(class), tolower(title) }
|
||||
'
|
||||
xprop -id "$(xdotool getactivewindow 2>/dev/null)" 2>/dev/null | awk '
|
||||
/^WM_CLASS/ {
|
||||
sub(/^WM_CLASS[^=]*= ?"[^"]*", "/, "")
|
||||
sub(/"$/, "")
|
||||
class = $0
|
||||
}
|
||||
/^WM_NAME/ {
|
||||
sub(/^WM_NAME[^=]*= ?"/, "")
|
||||
sub(/"$/, "")
|
||||
title = $0
|
||||
}
|
||||
END { printf "%s\n%s\n", tolower(class), tolower(title) }
|
||||
'
|
||||
}
|
||||
|
||||
_swi3_focusedwindow() {
|
||||
swi3msg -t get_tree | jq -r '
|
||||
recurse(.nodes[]) |
|
||||
select(.focused == true) |
|
||||
{
|
||||
app_id: ((if .app_id != null then
|
||||
.app_id
|
||||
else
|
||||
.window_properties.class
|
||||
end) // "" | tostring | gsub("\n"; "\\n") | ascii_downcase),
|
||||
name: ((.name // "") | tostring | gsub("\n"; "\\n") | ascii_downcase),
|
||||
} |
|
||||
select(.app_id != "" or .name != "") |
|
||||
"\(.app_id)\n\(.name)"
|
||||
'
|
||||
swi3msg -t get_tree | jq -r '
|
||||
recurse(.nodes[]) |
|
||||
select(.focused == true) |
|
||||
{
|
||||
app_id: ((if .app_id != null then
|
||||
.app_id
|
||||
else
|
||||
.window_properties.class
|
||||
end) // "" | tostring | gsub("\n"; "\\n") | ascii_downcase),
|
||||
name: ((.name // "") | tostring | gsub("\n"; "\\n") | ascii_downcase),
|
||||
} |
|
||||
select(.app_id != "" or .name != "") |
|
||||
"\(.app_id)\n\(.name)"
|
||||
'
|
||||
}
|
||||
|
||||
_raw_focusedwindow() {
|
||||
case "$SXMO_WM" in
|
||||
dwm) _xorgfocusedwindow ;;
|
||||
sway|i3) _swi3_focusedwindow ;;
|
||||
river) lswt -j | jq -r '
|
||||
.toplevels |
|
||||
map(select(.activated))[0] |
|
||||
(."app-id" | ascii_downcase), (.title | ascii_downcase)
|
||||
'
|
||||
esac
|
||||
case "$SXMO_WM" in
|
||||
dwm) _xorgfocusedwindow ;;
|
||||
sway|i3) _swi3_focusedwindow ;;
|
||||
river) lswt -j | jq -r '
|
||||
.toplevels |
|
||||
map(select(.activated))[0] |
|
||||
(."app-id" | ascii_downcase), (.title | ascii_downcase)
|
||||
'
|
||||
esac
|
||||
}
|
||||
|
||||
wm_generic_focusedwindow() {
|
||||
if [ "$1" = "-r" ]; then
|
||||
_raw_focusedwindow
|
||||
else
|
||||
# This script originally output this format, which is a bit
|
||||
# harder to parse. Keep it for backwards compatibility in case
|
||||
# anyone was using it.
|
||||
_raw_focusedwindow | {
|
||||
read -r app
|
||||
read -r title
|
||||
printf "app: %s\ntitle: %s\n" "$app" "$title"
|
||||
}
|
||||
fi
|
||||
if [ "$1" = "-r" ]; then
|
||||
_raw_focusedwindow
|
||||
else
|
||||
# This script originally output this format, which is a bit
|
||||
# harder to parse. Keep it for backwards compatibility in case
|
||||
# anyone was using it.
|
||||
_raw_focusedwindow | {
|
||||
read -r app
|
||||
read -r title
|
||||
printf "app: %s\ntitle: %s\n" "$app" "$title"
|
||||
}
|
||||
fi
|
||||
}
|
||||
# }}}
|
||||
|
||||
# paste {{{
|
||||
wlpaste() {
|
||||
wl-paste
|
||||
wl-paste
|
||||
}
|
||||
|
||||
xorgpaste() {
|
||||
xclip -o
|
||||
xclip -o
|
||||
}
|
||||
# }}}
|
||||
|
||||
# exec {{{
|
||||
wm_generic__swi3exec_inner() {
|
||||
cmd="$(cat "$1")"
|
||||
rm "$1"
|
||||
eval "$cmd"
|
||||
cmd="$(cat "$1")"
|
||||
rm "$1"
|
||||
eval "$cmd"
|
||||
}
|
||||
|
||||
swi3exec() {
|
||||
set -e
|
||||
set -e
|
||||
|
||||
cmdfile="$(mktemp)"
|
||||
jq -r --null-input '$ARGS.positional | @sh' --args -- "$@" > "$cmdfile"
|
||||
cmdfile="$(mktemp)"
|
||||
jq -r --null-input '$ARGS.positional | @sh' --args -- "$@" > "$cmdfile"
|
||||
|
||||
swi3msg exec "sxmo_wm.sh _swi3exec_inner '$cmdfile'" > /dev/null
|
||||
swi3msg exec "sxmo_wm.sh _swi3exec_inner '$cmdfile'" > /dev/null
|
||||
}
|
||||
|
||||
riverexec() {
|
||||
riverctl spawn "$@"
|
||||
riverctl spawn "$@"
|
||||
}
|
||||
|
||||
xorgexec() {
|
||||
if [ -z "$DISPLAY" ]; then
|
||||
export DISPLAY=:0
|
||||
fi
|
||||
"$@" &
|
||||
if [ -z "$DISPLAY" ]; then
|
||||
export DISPLAY=:0
|
||||
fi
|
||||
"$@" &
|
||||
}
|
||||
# }}}
|
||||
|
||||
# execwait {{{
|
||||
wm_generic__execwait_inner() {
|
||||
notify_file="$1/done"
|
||||
shift
|
||||
notify_file="$1/done"
|
||||
shift
|
||||
|
||||
# This opens the pipe for writing, when this process exits it will be
|
||||
# closed, which will send eof to the monitoring process.
|
||||
exec 3>"$notify_file"
|
||||
# This opens the pipe for writing, when this process exits it will be
|
||||
# closed, which will send eof to the monitoring process.
|
||||
exec 3>"$notify_file"
|
||||
|
||||
"$@"
|
||||
"$@"
|
||||
}
|
||||
|
||||
_execwait() {
|
||||
set -e
|
||||
runner="$1"
|
||||
shift
|
||||
set -e
|
||||
runner="$1"
|
||||
shift
|
||||
|
||||
notify_dir="$(mktemp -d)"
|
||||
mkfifo "$notify_dir/done"
|
||||
notify_dir="$(mktemp -d)"
|
||||
mkfifo "$notify_dir/done"
|
||||
|
||||
"$runner" sxmo_wm.sh _execwait_inner "$notify_dir" "$@"
|
||||
"$runner" sxmo_wm.sh _execwait_inner "$notify_dir" "$@"
|
||||
|
||||
exec 3<"$notify_dir/done"
|
||||
exec 3<"$notify_dir/done"
|
||||
|
||||
# The exec line won't finish until the inner file has been opened for
|
||||
# writing, so it's safe to remove the temp dir here.
|
||||
rm -r "$notify_dir"
|
||||
# The exec line won't finish until the inner file has been opened for
|
||||
# writing, so it's safe to remove the temp dir here.
|
||||
rm -r "$notify_dir"
|
||||
|
||||
# Wait for the notification file to be closed
|
||||
read -r _ <&3 || true
|
||||
# Wait for the notification file to be closed
|
||||
read -r _ <&3 || true
|
||||
}
|
||||
|
||||
swi3execwait() {
|
||||
_execwait swi3exec "$@"
|
||||
_execwait swi3exec "$@"
|
||||
}
|
||||
|
||||
riverexecwait() {
|
||||
_execwait riverexec "$@"
|
||||
_execwait riverexec "$@"
|
||||
}
|
||||
|
||||
xorgexecwait() {
|
||||
if [ -z "$DISPLAY" ]; then
|
||||
export DISPLAY=:0
|
||||
fi
|
||||
exec "$@"
|
||||
if [ -z "$DISPLAY" ]; then
|
||||
export DISPLAY=:0
|
||||
fi
|
||||
exec "$@"
|
||||
}
|
||||
# }}}
|
||||
|
||||
# toggle layout {{{
|
||||
swi3togglelayout() {
|
||||
swi3msg "layout toggle splitv splith tabbed" > /dev/null
|
||||
swi3msg "layout toggle splitv splith tabbed" > /dev/null
|
||||
}
|
||||
|
||||
dwmtogglelayout() {
|
||||
_dwm_prep
|
||||
xdotool key --clearmodifiers Super+space
|
||||
_dwm_prep
|
||||
xdotool key --clearmodifiers Super+space
|
||||
}
|
||||
|
||||
rivertogglelayout() {
|
||||
riverctl toggle-fullscreen
|
||||
riverctl toggle-fullscreen
|
||||
}
|
||||
# }}}
|
||||
|
||||
# switch focus {{{
|
||||
i3switchfocus() {
|
||||
sxmo_wmmenu.sh i3windowswitcher
|
||||
sxmo_wmmenu.sh i3windowswitcher
|
||||
}
|
||||
|
||||
swayswitchfocus() {
|
||||
sxmo_wmmenu.sh swaywindowswitcher
|
||||
sxmo_wmmenu.sh swaywindowswitcher
|
||||
}
|
||||
|
||||
dwmswitchfocus() {
|
||||
_dwm_prep
|
||||
xdotool key --clearmodifiers Super+x
|
||||
_dwm_prep
|
||||
xdotool key --clearmodifiers Super+x
|
||||
}
|
||||
# }}}
|
||||
|
||||
# workspace switching {{{
|
||||
_swi3getcurrentworkspace() {
|
||||
swi3msg -t get_workspaces | jq -r '.[] | select(.focused).name'
|
||||
swi3msg -t get_workspaces | jq -r '.[] | select(.focused).name'
|
||||
}
|
||||
|
||||
_swi3getnextworkspace() {
|
||||
value="$(($(_swi3getcurrentworkspace)+1))"
|
||||
if [ "$value" -eq "$((${SXMO_WORKSPACE_WRAPPING:-4}+1))" ]; then
|
||||
printf 1
|
||||
else
|
||||
printf %s "$value"
|
||||
fi
|
||||
value="$(($(_swi3getcurrentworkspace)+1))"
|
||||
if [ "$value" -eq "$((${SXMO_WORKSPACE_WRAPPING:-4}+1))" ]; then
|
||||
printf 1
|
||||
else
|
||||
printf %s "$value"
|
||||
fi
|
||||
}
|
||||
|
||||
_swi3getpreviousworkspace() {
|
||||
value="$(($(_swi3getcurrentworkspace)-1))"
|
||||
if [ "$value" -lt 1 ]; then
|
||||
if [ "${SXMO_WORKSPACE_WRAPPING:-4}" -ne 0 ]; then
|
||||
printf %s "${SXMO_WORKSPACE_WRAPPING:-4}"
|
||||
else
|
||||
return 1 # cant have previous workspace
|
||||
fi
|
||||
else
|
||||
printf %s "$value"
|
||||
fi
|
||||
value="$(($(_swi3getcurrentworkspace)-1))"
|
||||
if [ "$value" -lt 1 ]; then
|
||||
if [ "${SXMO_WORKSPACE_WRAPPING:-4}" -ne 0 ]; then
|
||||
printf %s "${SXMO_WORKSPACE_WRAPPING:-4}"
|
||||
else
|
||||
return 1 # cant have previous workspace
|
||||
fi
|
||||
else
|
||||
printf %s "$value"
|
||||
fi
|
||||
}
|
||||
|
||||
swi3nextworkspace() {
|
||||
swi3msg "workspace $(_swi3getnextworkspace)" > /dev/null
|
||||
swi3msg "workspace $(_swi3getnextworkspace)" > /dev/null
|
||||
}
|
||||
|
||||
rivernextworkspace() {
|
||||
river-shifttags
|
||||
river-shifttags
|
||||
}
|
||||
|
||||
dwmnextworkspace() {
|
||||
_dwm_prep
|
||||
xdotool key --clearmodifiers Super+Shift+r
|
||||
_dwm_prep
|
||||
xdotool key --clearmodifiers Super+Shift+r
|
||||
}
|
||||
|
||||
swi3previousworkspace() {
|
||||
swi3msg "workspace $(_swi3getpreviousworkspace )" > /dev/null
|
||||
swi3msg "workspace $(_swi3getpreviousworkspace )" > /dev/null
|
||||
}
|
||||
|
||||
dwmpreviousworkspace() {
|
||||
_dwm_prep
|
||||
xdotool key --clearmodifiers Super+Shift+e
|
||||
_dwm_prep
|
||||
xdotool key --clearmodifiers Super+Shift+e
|
||||
}
|
||||
|
||||
riverpreviousworkspace() {
|
||||
river-shifttags --shift -1
|
||||
river-shifttags --shift -1
|
||||
}
|
||||
|
||||
swi3movenextworkspace() {
|
||||
swi3msg "move container to workspace $(_swi3getnextworkspace)" > /dev/null
|
||||
swi3msg "move container to workspace $(_swi3getnextworkspace)" > /dev/null
|
||||
}
|
||||
|
||||
dwmmovenextworkspace() {
|
||||
_dwm_prep
|
||||
xdotool key --clearmodifiers Super+r
|
||||
_dwm_prep
|
||||
xdotool key --clearmodifiers Super+r
|
||||
}
|
||||
|
||||
swi3movepreviousworkspace() {
|
||||
swi3msg "move container to workspace $(_swi3getpreviousworkspace )" > /dev/null
|
||||
swi3msg "move container to workspace $(_swi3getpreviousworkspace )" > /dev/null
|
||||
}
|
||||
|
||||
dwmmovepreviousworkspace() {
|
||||
_dwm_prep
|
||||
xdotool key --clearmodifiers Super+e
|
||||
_dwm_prep
|
||||
xdotool key --clearmodifiers Super+e
|
||||
}
|
||||
|
||||
swi3workspace() {
|
||||
swi3msg "workspace $1" > /dev/null
|
||||
swi3msg "workspace $1" > /dev/null
|
||||
}
|
||||
|
||||
riverworkspace() {
|
||||
tags=$((1 << ($1 - 1)))
|
||||
riverctl set-focused-tags "$tags"
|
||||
tags=$((1 << ($1 - 1)))
|
||||
riverctl set-focused-tags "$tags"
|
||||
}
|
||||
|
||||
dwmworkspace() {
|
||||
_dwm_prep
|
||||
xdotool key --clearmodifiers "Super+$1"
|
||||
_dwm_prep
|
||||
xdotool key --clearmodifiers "Super+$1"
|
||||
}
|
||||
|
||||
swi3moveworkspace() {
|
||||
swi3msg "move container to workspace $1" > /dev/null
|
||||
swi3msg "move container to workspace $1" > /dev/null
|
||||
}
|
||||
|
||||
rivermoveworkspace() {
|
||||
tags=$((1 << ($1 - 1)))
|
||||
riverctl set-view-tags "$tags"
|
||||
tags=$((1 << ($1 - 1)))
|
||||
riverctl set-view-tags "$tags"
|
||||
}
|
||||
|
||||
dwmmoveworkspace() {
|
||||
_dwm_prep
|
||||
xdotool key --clearmodifiers "Super+shift+$1"
|
||||
_dwm_prep
|
||||
xdotool key --clearmodifiers "Super+shift+$1"
|
||||
}
|
||||
# }}}
|
||||
|
||||
# toggle bar {{{
|
||||
swi3togglebar() {
|
||||
swi3msg "bar mode toggle" > /dev/null
|
||||
swi3msg "bar mode toggle" > /dev/null
|
||||
}
|
||||
|
||||
dwmtogglebar() {
|
||||
if [ -z "$DISPLAY" ]; then
|
||||
export DISPLAY=:0
|
||||
fi
|
||||
xdotool key --clearmodifiers "Super+b"
|
||||
if [ -z "$DISPLAY" ]; then
|
||||
export DISPLAY=:0
|
||||
fi
|
||||
xdotool key --clearmodifiers "Super+b"
|
||||
}
|
||||
|
||||
rivertogglebar() {
|
||||
if superctl status sxmo_riverbar | grep -q started; then
|
||||
superctl stop sxmo_riverbar
|
||||
else
|
||||
superctl start sxmo_riverbar
|
||||
fi
|
||||
if superctl status sxmo_riverbar | grep -q started; then
|
||||
superctl stop sxmo_riverbar
|
||||
else
|
||||
superctl start sxmo_riverbar
|
||||
fi
|
||||
}
|
||||
# }}}
|
||||
|
||||
# configmenuentry {{{
|
||||
wm_generic_configmenuentry() {
|
||||
# shellcheck source=configs/default_hooks/sxmo_hook_icons.sh
|
||||
. sxmo_hook_icons.sh
|
||||
case "$SXMO_WM" in
|
||||
dwm)
|
||||
printf "%s\n" "$icon_cfg Edit configuration ^ 0 ^ sxmo_terminal.sh $EDITOR $XDG_CONFIG_HOME/sxmo/xinit"
|
||||
;;
|
||||
i3)
|
||||
printf "%s\n" "$icon_cfg Edit configuration ^ 0 ^ sxmo_terminal.sh $EDITOR $XDG_CONFIG_HOME/sxmo/i3"
|
||||
;;
|
||||
river)
|
||||
printf "%s\n" "$icon_cfg Edit configuration ^ 0 ^ sxmo_terminal.sh $EDITOR $XDG_CONFIG_HOME/sxmo/river"
|
||||
;;
|
||||
sway)
|
||||
printf "%s\n" "$icon_cfg Edit configuration ^ 0 ^ sxmo_terminal.sh $EDITOR $XDG_CONFIG_HOME/sxmo/sway"
|
||||
;;
|
||||
esac
|
||||
# shellcheck source=configs/default_hooks/sxmo_hook_icons.sh
|
||||
. sxmo_hook_icons.sh
|
||||
case "$SXMO_WM" in
|
||||
dwm)
|
||||
printf "%s\n" "$icon_cfg Edit configuration ^ 0 ^ sxmo_terminal.sh $EDITOR $XDG_CONFIG_HOME/sxmo/xinit"
|
||||
;;
|
||||
i3)
|
||||
printf "%s\n" "$icon_cfg Edit configuration ^ 0 ^ sxmo_terminal.sh $EDITOR $XDG_CONFIG_HOME/sxmo/i3"
|
||||
;;
|
||||
river)
|
||||
printf "%s\n" "$icon_cfg Edit configuration ^ 0 ^ sxmo_terminal.sh $EDITOR $XDG_CONFIG_HOME/sxmo/river"
|
||||
;;
|
||||
sway)
|
||||
printf "%s\n" "$icon_cfg Edit configuration ^ 0 ^ sxmo_terminal.sh $EDITOR $XDG_CONFIG_HOME/sxmo/sway"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
# }}}
|
||||
|
||||
dispatch() {
|
||||
if [ "$#" -lt 1 ]; then
|
||||
echo "Usage: sxmo_wm.sh <command>" >&2
|
||||
return 1
|
||||
fi
|
||||
if [ "$#" -lt 1 ]; then
|
||||
echo "Usage: sxmo_wm.sh <command>" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
action="$1"
|
||||
shift
|
||||
action="$1"
|
||||
shift
|
||||
|
||||
# invoke action covering single wm
|
||||
if type "$SXMO_WM$action" >/dev/null 2>&1; then
|
||||
"$SXMO_WM$action" "$@"
|
||||
return
|
||||
fi
|
||||
# invoke action covering single wm
|
||||
if type "$SXMO_WM$action" >/dev/null 2>&1; then
|
||||
"$SXMO_WM$action" "$@"
|
||||
return
|
||||
fi
|
||||
|
||||
# invoke action covering multiple wms
|
||||
if [ "$SXMO_WM" = "sway" ] || [ "$SXMO_WM" = "i3" ]; then
|
||||
if type "swi3$action" >/dev/null 2>&1; then
|
||||
"swi3$action" "$@"
|
||||
return
|
||||
fi
|
||||
fi
|
||||
# invoke action covering multiple wms
|
||||
if [ "$SXMO_WM" = "sway" ] || [ "$SXMO_WM" = "i3" ]; then
|
||||
if type "swi3$action" >/dev/null 2>&1; then
|
||||
"swi3$action" "$@"
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
# invoke action covering all of xorg/wayland
|
||||
case "$SXMO_WM" in
|
||||
dwm|i3)
|
||||
if type "xorg$action" >/dev/null 2>&1; then
|
||||
"xorg$action" "$@"
|
||||
return
|
||||
fi
|
||||
;;
|
||||
sway|river)
|
||||
# We don't yet support everything
|
||||
if type "wl$action" >/dev/null 2>&1; then
|
||||
"wl$action" "$@"
|
||||
return
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
# invoke action covering all of xorg/wayland
|
||||
case "$SXMO_WM" in
|
||||
dwm|i3)
|
||||
if type "xorg$action" >/dev/null 2>&1; then
|
||||
"xorg$action" "$@"
|
||||
return
|
||||
fi
|
||||
;;
|
||||
sway|river)
|
||||
# We don't yet support everything
|
||||
if type "wl$action" >/dev/null 2>&1; then
|
||||
"wl$action" "$@"
|
||||
return
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# invoke action covering all wms
|
||||
if type "wm_generic_$action" >/dev/null 2>&1; then
|
||||
"wm_generic_$action" "$@"
|
||||
return
|
||||
else
|
||||
printf "%s not implemented for %s\n" "$action" "$SXMO_WM" >&2
|
||||
return 1
|
||||
fi
|
||||
# invoke action covering all wms
|
||||
if type "wm_generic_$action" >/dev/null 2>&1; then
|
||||
"wm_generic_$action" "$@"
|
||||
return
|
||||
else
|
||||
printf "%s not implemented for %s\n" "$action" "$SXMO_WM" >&2
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
dispatch "$@"
|
||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user