From 257dba8399c63a5523e81eab25c77c866a6f98ee Mon Sep 17 00:00:00 2001 From: sommerfeld Date: Wed, 13 May 2026 13:43:17 +0100 Subject: feat(sway): skip _tb stash when cycling workspaces with super+tab --- dot_config/sway/config | 6 +++--- dot_config/sway/executable_ws-cycle.sh | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 dot_config/sway/executable_ws-cycle.sh diff --git a/dot_config/sway/config b/dot_config/sway/config index 5a0a6a0..2c2d4bf 100644 --- a/dot_config/sway/config +++ b/dot_config/sway/config @@ -117,9 +117,9 @@ bindsym $mod+Shift+e exec swaynag -t warning -m 'Exit sway?' -B 'Yes' 'swaymsg e # ── Personal keybinds ───────────────────────────────────────────────────────── -# Workspace cycling -bindsym $mod+Tab workspace next_on_output -bindsym $mod+Shift+Tab workspace prev_on_output +# Workspace cycling (skips the _tb stash workspace) +bindsym $mod+Tab exec ~/.config/sway/ws-cycle.sh next +bindsym $mod+Shift+Tab exec ~/.config/sway/ws-cycle.sh prev # Volume bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5% 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 -- cgit v1.3.1