diff options
Diffstat (limited to '.config/sway/bin')
-rwxr-xr-x | .config/sway/bin/workspace-add | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/.config/sway/bin/workspace-add b/.config/sway/bin/workspace-add new file mode 100755 index 0000000..42c9e7b --- /dev/null +++ b/.config/sway/bin/workspace-add @@ -0,0 +1,14 @@ +#!/bin/zsh + +CUR_WORKSPACE=$(swaymsg -t get_workspaces | jq -r '. | sort_by(.num) | map(.num) | .[]') + +previous=0 +while IFS= read -r n; do + if (( n != previous + 1 )) ; then + NEW_WORKSPACE=$(( previous + 1 )) + break + fi + previous=$n +done <<< "$CUR_WORKSPACE" + +swaymsg workspace number $NEW_WORKSPACE |