# All open windows as a table (class, title, workspace, floating, pid, pos, size)
def wins [] {
  ^hyprctl clients -j | from json
  | each {|w| {
      class:     $w.class
      title:     $w.title
      workspace: $w.workspace.name
      floating:  $w.floating
      pid:       $w.pid
      pos:       $"($w.at.0),($w.at.1)"
      size:      $"($w.size.0)x($w.size.1)"
  }}
}

# Workspaces with window count, sorted by id
def wsps [] {
  ^hyprctl workspaces -j | from json
  | select id name monitor windows hasfullscreen
  | sort-by id
}

# Currently focused window as a record
def hypr-active [] {
  ^hyprctl activewindow -j | from json
  | select class title workspace floating pid
  | upsert workspace { get workspace | get name }
}
