From 9f3b9f1dcc756dd94192da090388c1aa90320d23 Mon Sep 17 00:00:00 2001 From: sommerfeld Date: Wed, 13 May 2026 13:43:17 +0100 Subject: fix(sway): use get_workspaces for current ws in tb-toggle get_tree's workspace nodes don't carry a .focused field (only con nodes do), so current_ws was empty and the script emitted a malformed swaymsg command. get_workspaces exposes .focused directly on each workspace. --- dot_config/sway/executable_tb-toggle.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'dot_config') diff --git a/dot_config/sway/executable_tb-toggle.sh b/dot_config/sway/executable_tb-toggle.sh index d1e8a83..5288484 100644 --- a/dot_config/sway/executable_tb-toggle.sh +++ b/dot_config/sway/executable_tb-toggle.sh @@ -8,12 +8,10 @@ set -eu STASH=_tb MARK=tb-main -tree=$(swaymsg -t get_tree) +current_ws=$(swaymsg -t get_workspaces \ + | jq -r '.[] | select(.focused) | .name') -current_ws=$(printf '%s' "$tree" \ - | jq -r 'first(.. | objects | select(.type=="workspace" and .focused) | .name) // empty') - -tb_ws=$(printf '%s' "$tree" \ +tb_ws=$(swaymsg -t get_tree \ | jq -r --arg m "$MARK" ' first( .. | objects -- cgit v1.3.1