aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/dot_config/sway/executable_tb-toggle.sh
diff options
context:
space:
mode:
authorLibravatar sommerfeld <sommerfeld@sommerfeld.dev>2026-05-13 13:43:17 +0100
committerLibravatar sommerfeld <sommerfeld@sommerfeld.dev>2026-05-13 13:43:17 +0100
commit89c9213617aede2a220a7c3a49e0a76e91e33951 (patch)
tree3cfbedca0e6693157bfcabf67f7f115e3cfcc7f6 /dot_config/sway/executable_tb-toggle.sh
parent257dba8399c63a5523e81eab25c77c866a6f98ee (diff)
downloaddotfiles-89c9213617aede2a220a7c3a49e0a76e91e33951.tar.gz
dotfiles-89c9213617aede2a220a7c3a49e0a76e91e33951.tar.bz2
dotfiles-89c9213617aede2a220a7c3a49e0a76e91e33951.zip
refactor(sway): stash thunderbird in scratchpad instead of hidden ws
waybar's sway/workspaces has no ignore-list (that option is hyprland-only), so the _tb workspace always leaked into the bar and into super+tab cycling. Using sway's native scratchpad solves both: the __i3_scratch workspace is filtered automatically. We run 'floating disable' right after 'scratchpad show' so the window lands tiled on the current workspace, preserving the intended UX.
Diffstat (limited to 'dot_config/sway/executable_tb-toggle.sh')
-rw-r--r--dot_config/sway/executable_tb-toggle.sh35
1 files changed, 17 insertions, 18 deletions
diff --git a/dot_config/sway/executable_tb-toggle.sh b/dot_config/sway/executable_tb-toggle.sh
index 5288484..e52f20a 100644
--- a/dot_config/sway/executable_tb-toggle.sh
+++ b/dot_config/sway/executable_tb-toggle.sh
@@ -1,31 +1,30 @@
#!/bin/sh
-# Toggle the Thunderbird main window between the current workspace (tiled)
-# and a hidden stash workspace. If Thunderbird isn't running yet, launch it —
-# the for_window rule in sway config will mark and park it on the stash.
+# Toggle the Thunderbird main window between the sway scratchpad and the
+# current workspace (tiled). If Thunderbird isn't running yet, launch it —
+# the for_window rule in sway config will mark it and stash it.
set -eu
-STASH=_tb
MARK=tb-main
-current_ws=$(swaymsg -t get_workspaces \
- | jq -r '.[] | select(.focused) | .name')
-
-tb_ws=$(swaymsg -t get_tree \
- | jq -r --arg m "$MARK" '
- first(
- .. | objects
- | select(.type=="workspace")
- | select([.. | objects | select(.marks? // [] | index($m))] | length > 0)
- | .name
- ) // empty')
+# Find the workspace ancestor name of the con carrying MARK.
+# __i3_scratch means the window is currently stashed in the scratchpad.
+tb_ws=$(swaymsg -t get_tree | jq -r --arg m "$MARK" '
+ first(
+ .. | objects
+ | select(.type=="workspace")
+ | select([.. | objects | select(.marks? // [] | index($m))] | length > 0)
+ | .name
+ ) // empty')
if [ -z "$tb_ws" ]; then
exec thunderbird
fi
-if [ "$tb_ws" = "$current_ws" ]; then
- swaymsg "[con_mark=\"$MARK\"] move container to workspace $STASH" >/dev/null
+if [ "$tb_ws" = "__i3_scratch" ]; then
+ # scratchpad show reveals it as floating; floating disable tiles it on the
+ # current workspace.
+ swaymsg "[con_mark=\"$MARK\"] scratchpad show, floating disable" >/dev/null
else
- swaymsg "[con_mark=\"$MARK\"] move container to workspace $current_ws, focus" >/dev/null
+ swaymsg "[con_mark=\"$MARK\"] move container to scratchpad" >/dev/null
fi