Files
infra/dotfiles/desktop/.config/hypr/scripts/workspace-cycle
2026-06-06 16:08:35 +02:00

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"