$workspaces | map({
  id: .id,
  name: .name,
  activeOnCurrentScreen: .id == $activeWorkspace.id,
  activeOnAnyScreen: (.id as $workspaceId | any($monitors[]; .activeWorkspace.id == $workspaceId)),
  windows: (
    .id as $workspaceId | $clients | map ( select(.workspace.id == $workspaceId) | {
        class: .class,
        title: .title,
        pid: .pid,
        icon: (
          .class as $class |
          ($clientIcons | keys | .[] | select(. as $regex | $class | test($regex)) | $clientIcons[.]) // " "
        )
      })
  )
}) | sort_by(.id)
