From 0876dc71c0361817735982cba759958003a39281 Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Tue, 23 Nov 2021 15:37:24 +0000 Subject: [PATCH] BIN: actOnLast: small changes to how screenshots are handled If a shadow is added to a screenshot, that new images is added to the clipboard and the next event will be run against that. Also, add to clipboard is now something you can do after a screenshot (or shadow add) which is useful if you copy something, then want to re-add the last screenshot to your clipboard --- bin/.bin/dmenu/actOnLast | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/bin/.bin/dmenu/actOnLast b/bin/.bin/dmenu/actOnLast index 9664e942..acec8499 100755 --- a/bin/.bin/dmenu/actOnLast +++ b/bin/.bin/dmenu/actOnLast @@ -33,6 +33,7 @@ getSuggestions(){ printf "View\tsxiv\n" printf "add shadow\tscreenshotAddShadow\n" printf "OCR\tscreenshotOCR\n" + printf "Clipboard\tscreenshotClipboard\n" ;; password) echo "OTP passwordOTP" @@ -67,6 +68,13 @@ screenshotAddShadow(){ convert "$file" \( +clone -background black -shadow 80x20+0+15 \) +swap -background transparent -layers merge +repage "$newfile" #convert "$tmpfile" -bordercolor none -border 32 "$newfile" #rm "$tmpfile" + screenshotClipboard "$newfile" + notify-send "New Shadow On Screenshot" "$newfile" + echo "screenshot $newfile" > "$lastactionfile" +} + +screenshotClipboard(){ + file="$1" if [ -n "$WAYLAND_DISPLAY" ]; then # Copies the image to your clipboard (ctrl + v) wl-copy < "$file" @@ -74,12 +82,11 @@ screenshotAddShadow(){ echo -n "$file" | wl-copy --primary else # Copies the image to your clipboard (ctrl + v) - xclip -selection clipboard -target image/png -i "$newfile" + xclip -selection clipboard -target image/png -i "$file" # Copies the filename to primary selection (shift + insert or middle mouse) - echo -n "$newfile" | xclip -selection primary + echo -n "$file" | xclip -selection primary fi - notify-send "New Shadow On Screenshot" "$newfile" - echo "screenshot $newfile" > "$lastactionfile" + } passwordOTP(){