]> git.donarmstrong.com Git - bin.git/commitdiff
add script to remove empty i3 workspaces master
authorDon Armstrong <don@donarmstrong.com>
Thu, 19 Jun 2025 21:34:38 +0000 (14:34 -0700)
committerDon Armstrong <don@donarmstrong.com>
Thu, 19 Jun 2025 21:34:38 +0000 (14:34 -0700)
i3_remove_empty_workspaces [new file with mode: 0755]

diff --git a/i3_remove_empty_workspaces b/i3_remove_empty_workspaces
new file mode 100755 (executable)
index 0000000..b1969d3
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+focused_workspace=$(i3-msg -t get_workspaces|jq '.[map(.focused == true) | index(true)]["num"]')
+
+for a in $(i3-msg -t get_workspaces|jq '.[]["num"]'); do
+    i3-msg -q "workspace $a"
+done;
+
+i3-msg -q "workspace ${focused_workspace}"