sxmo-utils/scripts/core/sxmo_workspace.sh
Stacy Harper 8a27933c47 SWMO - SXMO over Wayland
This is a huge patch for Swmo, Sxmo over Sway.

It is Dwm backward compatible so dwm users should not expect regressions.

If you install all dependencies, you then can toggle between Sway and Dwm using a new config entry. It will reboot the phone.

This commit also contains:
    * Make the modemmonitor bullet proof
    * various other smaller fixes

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-08-22 13:23:22 +02:00

66 lines
1.1 KiB
Bash

#!/bin/bash
# include common definitions
# shellcheck source=scripts/core/sxmo_common.sh
. "$(dirname "$0")/sxmo_common.sh"
current() {
swaymsg -t get_outputs | \
jq -r '.[] | select(.focused == true) | .current_workspace'
}
next() {
value="$(($(current)+1))"
if [ "$value" -eq "$((${SXMO_WORKSPACE_WRAPPING:-4}+1))" ]; then
printf 1
else
printf %s "$value"
fi
}
previous() {
value="$(($(current)-1))"
if [ "$value" -lt 1 ]; then
if [ "${SXMO_WORKSPACE_WRAPPING:-4}" -ne 0 ]; then
printf %s "${SXMO_WORKSPACE_WRAPPING:-4}"
fi
else
printf %s "$value"
fi
}
sway() {
case "$1" in
next)
printf "workspace "
next;;
previous)
printf "workspace "
previous;;
move-next)
printf "move container to workspace "
next;;
move-previous)
printf "move container to workspace "
previous;;
esac | xargs swaymsg
}
dwm() {
case "$1" in
next)
xdotool key Super+Shift+r
;;
previous)
xdotool key Super+Shift+e
;;
move-next)
xdotool key Super+r
;;
move-previous)
xdotool key Super+e
;;
esac
}
"$(sxmo_wm.sh)" "$@"