From 95f1f312b409902fd2a556cc42d390f4deff3696 Mon Sep 17 00:00:00 2001 From: riozee Date: Wed, 29 Oct 2025 12:16:57 +0900 Subject: [PATCH] Fix: omarchy-cmd-screenshot geometry for transformed monitors --- bin/omarchy-cmd-screenshot | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/bin/omarchy-cmd-screenshot b/bin/omarchy-cmd-screenshot index f4450f89..76257dfb 100755 --- a/bin/omarchy-cmd-screenshot +++ b/bin/omarchy-cmd-screenshot @@ -13,9 +13,23 @@ pkill slurp && exit 0 MODE="${1:-smart}" PROCESSING="${2:-slurp}" +# accounting for portrait/transformed displays +JQ_MONITOR_GEO=' + def format_geo: + .x as $x | .y as $y | + (.width / .scale | floor) as $w | + (.height / .scale | floor) as $h | + .transform as $t | + if $t == 1 or $t == 3 then + "\($x),\($y) \($h)x\($w)" + else + "\($x),\($y) \($w)x\($h)" + end; +' + 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 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])"' } @@ -34,7 +48,7 @@ case "$MODE" in kill $PID 2>/dev/null ;; fullscreen) - SELECTION=$(hyprctl monitors -j | jq -r '.[] | select(.focused == true) | "\(.x),\(.y) \((.width / .scale) | floor)x\((.height / .scale) | floor)"') + SELECTION=$(hyprctl monitors -j | jq -r "${JQ_MONITOR_GEO} .[] | select(.focused == true) | format_geo") ;; smart|*) RECTS=$(get_rectangles)