From b52496bbb3513b3d2d6bd2e8dad99939066c3e91 Mon Sep 17 00:00:00 2001 From: Joe Groocock Date: Sat, 30 May 2020 00:12:21 +0100 Subject: [PATCH] scripts/screenshot: add --active and --clip args --active uses the active window as selection boundary, instead of the root window, or prompting for a window selection --clip adds the image to the clipboard and exits without uploading Signed-off-by: Joe Groocock --- scripts/screenshot | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/scripts/screenshot b/scripts/screenshot index 1c99fc7..a2416e7 100755 --- a/scripts/screenshot +++ b/scripts/screenshot @@ -43,6 +43,9 @@ args=(-g "$geom") if xwininfo -id "$winid" | grep -qw root; then isroot=1 args+=(-i "$winid") +elif [ "$1" == "--active" -o "$1" == "-a" ]; then + args+=(-i "$(xdotool getactivewindow)") + shift fi # Take the screenshot and save it @@ -57,10 +60,15 @@ if [ "$isroot" != "1" ]; then convert "$out_path" \( +clone -background black -alpha set -channel Alpha -evaluate set 60% -shadow 100x16+0+0 \) +swap -background none -layers merge +repage "$out_path" || : fi -notif_id=$(send_notification "Screenshot uploading" "$FILENAME

The image is available in the clipboard immediately" || true) +if [ "$1" == "--clip" -o "$1" == "-c" ]; then + # Add image to clipboard + xclip -i "$out_path" -selection clipboard -t image/png + send_notification "Screenshot captured" "$FILENAME

The image is available in the clipboard" -# Add image to clipboard -xclip -i "$out_path" -selection clipboard -t image/png + exit 0 +fi + +notif_id=$(send_notification "Screenshot uploading" "$FILENAME" || true) # 'Upload' the screenshot if ! error=$(scp -C $out_path $SCP_HOST:$SCP_PATH 2>&1); then