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
Jonathan Hodgson 2 years ago
parent 8533081145
commit 0876dc71c0
  1. 15
      bin/.bin/dmenu/actOnLast

@ -33,6 +33,7 @@ getSuggestions(){
printf "View\tsxiv\n" printf "View\tsxiv\n"
printf "add shadow\tscreenshotAddShadow\n" printf "add shadow\tscreenshotAddShadow\n"
printf "OCR\tscreenshotOCR\n" printf "OCR\tscreenshotOCR\n"
printf "Clipboard\tscreenshotClipboard\n"
;; ;;
password) password)
echo "OTP passwordOTP" 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 "$file" \( +clone -background black -shadow 80x20+0+15 \) +swap -background transparent -layers merge +repage "$newfile"
#convert "$tmpfile" -bordercolor none -border 32 "$newfile" #convert "$tmpfile" -bordercolor none -border 32 "$newfile"
#rm "$tmpfile" #rm "$tmpfile"
screenshotClipboard "$newfile"
notify-send "New Shadow On Screenshot" "$newfile"
echo "screenshot $newfile" > "$lastactionfile"
}
screenshotClipboard(){
file="$1"
if [ -n "$WAYLAND_DISPLAY" ]; then if [ -n "$WAYLAND_DISPLAY" ]; then
# Copies the image to your clipboard (ctrl + v) # Copies the image to your clipboard (ctrl + v)
wl-copy < "$file" wl-copy < "$file"
@ -74,12 +82,11 @@ screenshotAddShadow(){
echo -n "$file" | wl-copy --primary echo -n "$file" | wl-copy --primary
else else
# Copies the image to your clipboard (ctrl + v) # 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) # Copies the filename to primary selection (shift + insert or middle mouse)
echo -n "$newfile" | xclip -selection primary echo -n "$file" | xclip -selection primary
fi fi
notify-send "New Shadow On Screenshot" "$newfile"
echo "screenshot $newfile" > "$lastactionfile"
} }
passwordOTP(){ passwordOTP(){

Loading…
Cancel
Save