#!/bin/bash

# Function to get and format workspaces
get_workspaces() {
    swaymsg -t get_workspaces | jq -c '[.[] | {id: .num, output: .output, focused: .focused, visible: .visible, urgent: .urgent}]'
}

# Output initial state
get_workspaces

# Subscribe to workspace events and output updates
swaymsg -t subscribe -m '["workspace"]' | while read -r event; do
    get_workspaces
done
