Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions bin/omarchy-capture-screenrecording
Original file line number Diff line number Diff line change
Expand Up @@ -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])"'
}

Expand Down
12 changes: 9 additions & 3 deletions bin/omarchy-capture-screenshot
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down