From 2b4d89a9eaf88cd0f6aa5a8d61b56ac3bd574e42 Mon Sep 17 00:00:00 2001 From: Ryan Hughes Date: Fri, 24 Apr 2026 19:23:07 -0400 Subject: [PATCH] Keep hyprpicker alive until capture is complete to prevent mid-transition screenshots --- bin/omarchy-cmd-screenshot | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bin/omarchy-cmd-screenshot b/bin/omarchy-cmd-screenshot index 9036c995..99e2976a 100755 --- a/bin/omarchy-cmd-screenshot +++ b/bin/omarchy-cmd-screenshot @@ -63,6 +63,13 @@ get_rectangles() { hyprctl clients -j | jq -r --arg ws "$active_workspace" '.[] | select(.workspace.id == ($ws | tonumber)) | "\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1])"' } +# Keep hyprpicker alive until after grim captures so the screenshot sees the +# frozen overlay rather than live content shifting during teardown. +cleanup_freeze() { + [[ -n $PID ]] && kill $PID 2>/dev/null +} +trap cleanup_freeze EXIT + # Select based on mode case "$MODE" in region) @@ -70,14 +77,12 @@ region) PID=$! sleep .1 SELECTION=$(slurp 2>/dev/null) - kill $PID 2>/dev/null ;; windows) hyprpicker -r -z >/dev/null 2>&1 & PID=$! sleep .1 SELECTION=$(get_rectangles | slurp -r 2>/dev/null) - kill $PID 2>/dev/null ;; fullscreen) SELECTION=$(hyprctl monitors -j | jq -r "${JQ_MONITOR_GEO} .[] | select(.focused == true) | format_geo") @@ -88,7 +93,6 @@ smart | *) PID=$! sleep .1 SELECTION=$(echo "$RECTS" | slurp 2>/dev/null) - kill $PID 2>/dev/null # If the selection area is L * W < 20, we'll assume you were trying to select whichever # window or output it was inside of to prevent accidental 2px snapshots