aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/dot_config/sway
diff options
context:
space:
mode:
authorLibravatar sommerfeld <sommerfeld@sommerfeld.dev>2026-05-13 13:43:16 +0100
committerLibravatar sommerfeld <sommerfeld@sommerfeld.dev>2026-05-13 13:43:16 +0100
commit0426222d312a2e1fa9632bb8b14ced8eee75fcae (patch)
tree608b9dc7a92edf7cef059db3fb84592cf51d69a2 /dot_config/sway
parentcf9c225c9fc6f37511fd05f13ac53d4f111d1994 (diff)
downloaddotfiles-0426222d312a2e1fa9632bb8b14ced8eee75fcae.tar.gz
dotfiles-0426222d312a2e1fa9632bb8b14ced8eee75fcae.tar.bz2
dotfiles-0426222d312a2e1fa9632bb8b14ced8eee75fcae.zip
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.
Diffstat (limited to 'dot_config/sway')
-rw-r--r--dot_config/sway/config9
-rw-r--r--dot_config/sway/executable_tb-toggle.sh33
2 files changed, 39 insertions, 3 deletions
diff --git a/dot_config/sway/config b/dot_config/sway/config
index 5acb897..5a0a6a0 100644
--- a/dot_config/sway/config
+++ b/dot_config/sway/config
@@ -43,7 +43,7 @@ output * bg #282828 solid_color
for_window [class="feh"] floating enable
for_window [app_id="imv"] floating enable
for_window [class="Tor Browser"] floating enable
-for_window [app_id="org.mozilla.Thunderbird" title=".*Mozilla Thunderbird$"] move to scratchpad
+for_window [app_id="org.mozilla.Thunderbird" title=".*Mozilla Thunderbird$"] mark --add tb-main, move container to workspace _tb
# ── Standard keybinds (sway defaults) ─────────────────────────────────────────
bindsym $mod+Return exec $term
@@ -156,8 +156,10 @@ mode "qr" {
}
bindsym $mod+z mode "qr"
-# Thunderbird scratchpad toggle (auto-parked on launch, see window rules)
-bindsym $mod+t [app_id="org.mozilla.Thunderbird" title=".*Mozilla Thunderbird$"] scratchpad show, resize set width 100 ppt height 100 ppt, move position center
+# Thunderbird toggle: main window parked on hidden workspace _tb; this pulls it
+# to the current workspace (tiled) or sends it back. Child windows (compose,
+# viewer, calendar, prefs) tile normally wherever Thunderbird spawns them.
+bindsym $mod+t exec ~/.config/sway/tb-toggle.sh
# ── Bar ───────────────────────────────────────────────────────────────────────
bar {
@@ -169,6 +171,7 @@ exec systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CU
exec dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP
exec "sleep 2 && ~/.config/sway/display-toggle.sh init"
exec systemctl --user start sway-session.target
+exec thunderbird
# GTK4 reads dark mode from gsettings (settings.ini's prefer-dark is GTK3 only).
exec gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'
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