blob: d1e8a83b183c6abbb9fefd92c58328c63cfdbe8f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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
|