#!/usr/bin/env bash min_workspaces=4 spaces (){ WORKSPACE_WINDOWS=$(hyprctl workspaces -j | jq 'map({key: .id | tostring, value: .windows}) | from_entries') seq 1 "$(echo "$WORKSPACE_WINDOWS" | jq -r 'keys | .[] |= tonumber | .+['$min_workspaces'] | max')" | jq --argjson windows "${WORKSPACE_WINDOWS}" --slurp -Mc 'map(tostring) | map({id: ., windows: ($windows[.]//0)})' } spaces socat -u "UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock" - | while read -r; do spaces done