From ea2a9e0b45e0b72febfcbea52f12e85149cec406 Mon Sep 17 00:00:00 2001 From: Leaced Date: Sat, 25 Mar 2023 23:21:28 +0100 Subject: [PATCH] Bugfix for fullscreen a bug caused images to be cropped in full-screen by some pixels --- .config/sway/screenshot.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.config/sway/screenshot.sh b/.config/sway/screenshot.sh index ebd106c..acb062a 100644 --- a/.config/sway/screenshot.sh +++ b/.config/sway/screenshot.sh @@ -9,11 +9,16 @@ all) #Screenshot of all outputs grim -t jpeg -q 100 $FILENAME ;; focus) # Screenshot of focused window - geometry="$(echo $( + geometry=$( swaymsg -t get_tree | - grep -A 8 \"focused\"\:\ true | - grep -o "[0-9]*") | - awk '{printf "%d,%d %dx%d", $2+$1,$3+$1,$4-2*$1,$5-2*$1}')" + awk ' + BEGIN { ORS=" " }; + lines_after&&lines_after-- {print $2+0}; #loop over n lines. Print only numbers + /focused": true/,/window_rect/ { + if($1=="\"window_rect\":") lines_after=4; + if($1=="\"rect\":") lines_after=2 + }' | + awk '{printf "%d,%d %dx%d", $1+$3,$2+$4,$5,$6}') grim -t jpeg -q 100 -g "$geometry" $FILENAME ;; choice) #Screenshot von Auswahl