sxmo-utils/scripts/core/sxmo_workspace.sh
Maxim Karasev 1a1f40cc81
Change shebang to '/usr/bin/env sh' in sxmo_workspace.sh
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2021-08-27 22:45:19 +02:00

66 lines
1.1 KiB
Bash

#!/usr/bin/env sh
# 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)" "$@"