From 6f75cc55c4a2f55d32984e1e6c05d49dca310762 Mon Sep 17 00:00:00 2001 From: sommerfeld Date: Fri, 14 Aug 2026 14:21:05 +0100 Subject: Fix Thunderbird scratchpad targeting --- dot_config/sway/executable_tb-autostart.sh | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'dot_config/sway/executable_tb-autostart.sh') diff --git a/dot_config/sway/executable_tb-autostart.sh b/dot_config/sway/executable_tb-autostart.sh index b7b9b78..d9e503f 100644 --- a/dot_config/sway/executable_tb-autostart.sh +++ b/dot_config/sway/executable_tb-autostart.sh @@ -7,6 +7,8 @@ set -eu MARK=tb-main +APP_ID=org.mozilla.thunderbird +TITLE_SUFFIX="Mozilla Thunderbird" BRIDGE_HOST=127.0.0.1 BRIDGE_IMAP_PORT=1144 BRIDGE_SMTP_PORT=1016 @@ -32,10 +34,17 @@ done flatpak run org.mozilla.thunderbird & for _ in $(seq 1 200); do - if swaymsg -t get_tree | jq -e --arg m "$MARK" ' - [.. | objects | select(.marks? // [] | index($m))] | length > 0 - ' >/dev/null 2>&1; then - swaymsg "[con_mark=\"$MARK\"] move container to scratchpad" >/dev/null + tb_id=$(swaymsg -t get_tree | jq -r \ + --arg app "$APP_ID" --arg suffix "$TITLE_SUFFIX" ' + first( + .. | objects + | select(.app_id? == $app) + | select((.name? // "") | endswith($suffix)) + | .id + ) // empty') + if [ -n "$tb_id" ]; then + swaymsg "[con_id=\"$tb_id\"] mark --add $MARK" >/dev/null + swaymsg "[con_id=\"$tb_id\"] move container to scratchpad" >/dev/null exit 0 fi sleep 0.1 -- cgit v1.3.1