From 0426222d312a2e1fa9632bb8b14ced8eee75fcae Mon Sep 17 00:00:00 2001 From: sommerfeld Date: Wed, 13 May 2026 13:43:16 +0100 Subject: refactor(sway): make thunderbird toggle tile instead of float Scratchpad is inherently floating; the user wants the main TB window to tile normally when shown and disappear completely when hidden. Park the main window on a hidden workspace _tb via for_window, then toggle it with a small swaymsg+jq script that moves it between _tb and the currently focused workspace. Child windows (compose, viewer, calendar, prefs) are unaffected and tile wherever they spawn. - Autostart thunderbird so the window exists on login, parked on _tb. - Hide _tb from waybar's workspace list. - Update KEYBINDS.md. --- dot_config/sway/executable_tb-toggle.sh | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 dot_config/sway/executable_tb-toggle.sh (limited to 'dot_config/sway/executable_tb-toggle.sh') diff --git a/dot_config/sway/executable_tb-toggle.sh b/dot_config/sway/executable_tb-toggle.sh new file mode 100644 index 0000000..d1e8a83 --- /dev/null +++ b/dot_config/sway/executable_tb-toggle.sh @@ -0,0 +1,33 @@ +#!/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. + +set -eu + +STASH=_tb +MARK=tb-main + +tree=$(swaymsg -t get_tree) + +current_ws=$(printf '%s' "$tree" \ + | jq -r 'first(.. | objects | select(.type=="workspace" and .focused) | .name) // empty') + +tb_ws=$(printf '%s' "$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 +else + swaymsg "[con_mark=\"$MARK\"] move container to workspace $current_ws, focus" >/dev/null +fi -- cgit v1.3.1