summaryrefslogtreecommitdiff
path: root/.config/sway/bin/workspace-add
diff options
context:
space:
mode:
authorDaniel Weipert <git@mail.dweipert.de>2024-07-19 12:11:38 +0200
committerDaniel Weipert <git@mail.dweipert.de>2024-07-19 12:15:15 +0200
commitd17c0364f1053cf8080a6e8d6438a1d43fc42532 (patch)
treead4b841b9603273de9ff04dbf4119c469c05bd71 /.config/sway/bin/workspace-add
parent485b513b2e82aa3dcf86e4b0ae8a1fa7bc4e004b (diff)
[sway+i3] pactl and other config adjustments
Diffstat (limited to '.config/sway/bin/workspace-add')
-rwxr-xr-x.config/sway/bin/workspace-add14
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