summaryrefslogtreecommitdiff
path: root/.config/sway/bin/workspace-add
blob: 42c9e7b0764fa8ccfb6a688cd6b13ac26ab648e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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