nicks-nix-config/modules/ewwbar/eww-config/scripts/change-active-workspace

23 lines
412 B
Text
Raw Normal View History

2023-10-29 16:52:44 -07:00
#!/usr/bin/env bash
#
2023-10-24 18:31:26 -07:00
function clamp {
min=$1
max=$2
val=$3
python -c "print(max($min, min($val, $max)))"
}
direction=$1
current=$2
if test "$direction" = "down"
then
target=$(clamp 1 10 $(($current+1)))
echo "jumping to $target"
hyprctl dispatch workspace $target
elif test "$direction" = "up"
then
target=$(clamp 1 10 $(($current-1)))
echo "jumping to $target"
hyprctl dispatch workspace $target
fi