diff options
| author | 2026-05-13 13:43:17 +0100 | |
|---|---|---|
| committer | 2026-05-13 13:43:17 +0100 | |
| commit | 257dba8399c63a5523e81eab25c77c866a6f98ee (patch) | |
| tree | 90b70f1d48c835090404cc4991fc389ac1e217bb /dot_config/sway/executable_ws-cycle.sh | |
| parent | 9f3b9f1dcc756dd94192da090388c1aa90320d23 (diff) | |
| download | dotfiles-257dba8399c63a5523e81eab25c77c866a6f98ee.tar.gz dotfiles-257dba8399c63a5523e81eab25c77c866a6f98ee.tar.bz2 dotfiles-257dba8399c63a5523e81eab25c77c866a6f98ee.zip | |
feat(sway): skip _tb stash when cycling workspaces with super+tab
Diffstat (limited to 'dot_config/sway/executable_ws-cycle.sh')
| -rw-r--r-- | dot_config/sway/executable_ws-cycle.sh | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/dot_config/sway/executable_ws-cycle.sh b/dot_config/sway/executable_ws-cycle.sh new file mode 100644 index 0000000..28a97f0 --- /dev/null +++ b/dot_config/sway/executable_ws-cycle.sh @@ -0,0 +1,18 @@ +#!/bin/sh +# Cycle to the next/previous workspace on the current output, skipping +# the _tb stash workspace. Usage: ws-cycle.sh next|prev +set -eu + +DIR=${1:?usage: ws-cycle.sh next|prev} +SKIP=_tb + +swaymsg -t get_workspaces | jq -r --arg dir "$DIR" --arg skip "$SKIP" ' + (map(select(.focused)) | .[0]) as $cur + | map(select(.output == $cur.output and .name != $skip)) + | sort_by(.num, .name) as $list + | ($list | map(.name == $cur.name) | index(true)) as $i + | if $i == null then $list[0].name + elif $dir == "next" then $list[(($i + 1) % ($list | length))].name + else $list[(($i - 1 + ($list | length)) % ($list | length))].name + end +' | xargs -I{} swaymsg workspace {} >/dev/null |
