aboutsummarylogtreecommitdiffstats
path: root/i3-auto-arrange.sh
diff options
context:
space:
mode:
Diffstat (limited to 'i3-auto-arrange.sh')
-rwxr-xr-xi3-auto-arrange.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/i3-auto-arrange.sh b/i3-auto-arrange.sh
new file mode 100755
index 000000000000..37f700bb762b
--- /dev/null
+++ b/i3-auto-arrange.sh
@@ -0,0 +1,16 @@
+#! /bin/sh
+
+workspaces=$(i3-msg -t get_workspaces)
+n_workspaces=$(echo "$workspaces" | jq length)
+
+i=0
+while [ "$i" -lt "$n_workspaces" ]
+do
+ current_number=$(echo "$workspaces" | jq ".[$i].n_workspaces")
+ expected_number=$($i + 1)
+
+ if [ "$current_number" -ne "$expected_number" ]
+ then
+ i3-msg -q rename workspace "$current_number" to "$expected_number"
+ fi
+done