aboutsummarylogtreecommitdiffstats
path: root/i3-auto-arrange.sh
blob: 37f700bb762b2cc3933bc74cb9913bdfb14d30c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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