diff --git a/bin/omarchy-capture-screenrecording b/bin/omarchy-capture-screenrecording index 75a5c20722..516d0373f9 100755 --- a/bin/omarchy-capture-screenrecording +++ b/bin/omarchy-capture-screenrecording @@ -100,15 +100,18 @@ default_resolution() { fi } -# Monitor + window rectangles on the focused workspace, in slurp's "X,Y WxH" format. +# All monitor geometries + windows on visible workspaces, in slurp's "X,Y WxH" format. # Mirrors omarchy-capture-screenshot so the picker UX is identical. get_rectangles() { - local active_workspace=$(hyprctl monitors -j | jq -r '.[] | select(.focused == true) | .activeWorkspace.id') - hyprctl monitors -j | jq -r --arg ws "$active_workspace" ' - .[] | select(.activeWorkspace.id == ($ws | tonumber)) | - "\(.x),\(.y) \(.width / .scale | floor)x\(.height / .scale | floor)"' - hyprctl clients -j | jq -r --arg ws "$active_workspace" ' - .[] | select(.workspace.id == ($ws | tonumber)) | + local monitors_json=$(hyprctl monitors -j) + local clients_json=$(hyprctl clients -j) + + echo "$monitors_json" | jq -r ' + .[] | "\(.x),\(.y) \(.width / .scale | floor)x\(.height / .scale | floor)"' + + echo "$clients_json" | jq -r --argjson active \ + "$(echo "$monitors_json" | jq -c 'map(.activeWorkspace.id)')" ' + .[] | select(.workspace.id as $id | $active | index($id)) | "\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1])"' } diff --git a/bin/omarchy-capture-screenshot b/bin/omarchy-capture-screenshot index 572330f78d..0839af00b4 100755 --- a/bin/omarchy-capture-screenshot +++ b/bin/omarchy-capture-screenshot @@ -60,9 +60,15 @@ JQ_MONITOR_GEO=' ' get_rectangles() { - local active_workspace=$(hyprctl monitors -j | jq -r '.[] | select(.focused == true) | .activeWorkspace.id') - hyprctl monitors -j | jq -r --arg ws "$active_workspace" "${JQ_MONITOR_GEO} .[] | select(.activeWorkspace.id == (\$ws | tonumber)) | format_geo" - hyprctl clients -j | jq -r --arg ws "$active_workspace" '.[] | select(.workspace.id == ($ws | tonumber)) | "\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1])"' + local monitors_json=$(hyprctl monitors -j) + local clients_json=$(hyprctl clients -j) + + echo "$monitors_json" | jq -r "${JQ_MONITOR_GEO} .[] | format_geo" + + echo "$clients_json" | jq -r --argjson active \ + "$(echo "$monitors_json" | jq -c 'map(.activeWorkspace.id)')" ' + .[] | select(.workspace.id as $id | $active | index($id)) | + "\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1])"' } # Keep hyprpicker alive until after grim captures so the screenshot sees the