25 lines
648 B
Bash
25 lines
648 B
Bash
BASE_WS="$1"
|
|
ACTION="$2"
|
|
|
|
current_ws_id="$(hyprctl -j activeworkspace | jq -r '.id')"
|
|
|
|
ws_json="$(hyprctl -j workspaces)"
|
|
max_ws_id="$(echo "$ws_json" | jq -r '[.[] | .id] | max')"
|
|
|
|
BLOCK_SIZE=10
|
|
|
|
total_blocks=$(((max_ws_id - 1) / BLOCK_SIZE + 1))
|
|
current_block=$(((current_ws_id - 1) / BLOCK_SIZE))
|
|
target_ws=$((current_block * BLOCK_SIZE + BASE_WS))
|
|
|
|
if [ "$target_ws" -eq "$current_ws_id" ]; then
|
|
next_block=$(( (current_block + 1) % total_blocks ))
|
|
target_ws=$(( next_block * BLOCK_SIZE + BASE_WS ))
|
|
fi
|
|
|
|
if [ "$ACTION" = "move" ]; then
|
|
hyprctl dispatch movetoworkspacesilent "$target_ws"
|
|
else
|
|
hyprctl dispatch workspace "$target_ws"
|
|
fi
|