#!/usr/bin/env nu

let active = (hyprctl activeworkspace -j | from json | get id)

hyprctl workspaces -j | 
    from json |
	sort-by id |
    each {|w| {$w.id: {monitor: $w.monitorID active: ($w.id == $active) }}} |
	reduce {|a, b| $a | merge $b } |
	to json
