summaryrefslogtreecommitdiff
path: root/.config/eww/scripts/workspace-list-listener
blob: 6dc3e4b9c63115c4444ed5a6e2fbecf25fd11d3e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/sh

readonly IPC="$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock"

hyprctl -j workspaces | jq -cr '
	[.[].id]
	| group_by(. / 10 | floor)
	| [.[] | map(. % 10)]
'

socat -u UNIX-CONNECT:"$IPC" - \
	| stdbuf -oL grep -E '^(create|destroy)workspace>>' \
	| while read -r _
	do
		hyprctl -j workspaces | jq -cr '
			[.[].id]
			| group_by(. / 10 | floor)
			| [.[] | map(. % 10) | sort_by(.)]
		'
	done