mirror of
https://github.com/fscotto/infra.git
synced 2026-07-29 16:20:01 +00:00
35 lines
625 B
Bash
Executable File
35 lines
625 B
Bash
Executable File
#!/bin/sh
|
|
# Cycle Hyprland workspaces within the fixed 1..10 desktop set.
|
|
|
|
set -eu
|
|
|
|
direction="${1:-next}"
|
|
current="$(hyprctl activeworkspace -j | jq -r '.id')"
|
|
|
|
case "$current" in
|
|
''|*[!0-9-]*) current=1 ;;
|
|
esac
|
|
|
|
case "$direction" in
|
|
next)
|
|
if [ "$current" -ge 10 ] || [ "$current" -lt 1 ]; then
|
|
target=1
|
|
else
|
|
target=$((current + 1))
|
|
fi
|
|
;;
|
|
prev)
|
|
if [ "$current" -le 1 ] || [ "$current" -gt 10 ]; then
|
|
target=10
|
|
else
|
|
target=$((current - 1))
|
|
fi
|
|
;;
|
|
*)
|
|
printf 'Usage: %s {next|prev}\n' "$0" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
exec hyprctl dispatch workspace "$target"
|