nixos-flake/home-manager/jwm/eww/hyprworkspace

22 lines
579 B
Bash
Executable file

#!/bin/sh
cmd=$1
monitor=$2
current=$3
if [ "$cmd" = "down" ]; then
to_change=$(
hyprctl workspaces -j | jq --raw-output '
[ .[] | select(.monitor == "'$monitor'" and .id > 0) | .id ] |
([ .[] | select(. < '$current') ] | max) // max
')
elif [ "$cmd" = "up" ]; then
to_change=$(
hyprctl workspaces -j | jq --raw-output '
[ .[] | select(.monitor == "'$monitor'" and .id > 0) | .id ] |
([ .[] | select(. > '$current') ] | min) // min
')
fi
hyprctl dispatch workspace $to_change >/dev/null