screenshot: add post-capture notification and wofi action picker
This commit is contained in:
Regular → Executable
+38
-2
@@ -1,5 +1,41 @@
|
||||
#!/bin/bash
|
||||
|
||||
FILE=~/Pictures/screenshot-$(date +%s).png
|
||||
grim -g "$(slurp)" "$FILE"
|
||||
FILE="$HOME/Pictures/screenshot-$(date +%s).png"
|
||||
|
||||
# Exit silently if the user cancels region selection
|
||||
if ! grim -g "$(slurp)" "$FILE"; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
wl-copy < "$FILE"
|
||||
|
||||
action=$(notify-send "Screenshot captured" \
|
||||
"Saved · Copied to clipboard" \
|
||||
--hint="string:image-path:$FILE" \
|
||||
--expire-time=10000 \
|
||||
--action="actions=Actions")
|
||||
|
||||
[[ "$action" != "actions" ]] && exit 0
|
||||
|
||||
choice=$(printf 'Annotate with swappy\nAnnotate with satty\nOpen in imv\nCopy path\nDelete' \
|
||||
| wofi --dmenu --prompt "Screenshot")
|
||||
|
||||
case "$choice" in
|
||||
"Annotate with swappy")
|
||||
swappy -f "$FILE" &
|
||||
;;
|
||||
"Annotate with satty")
|
||||
satty --filename "$FILE" &
|
||||
;;
|
||||
"Open in imv")
|
||||
imv "$FILE" &
|
||||
;;
|
||||
"Copy path")
|
||||
printf '%s' "$FILE" | wl-copy
|
||||
notify-send "Path copied" "$FILE"
|
||||
;;
|
||||
"Delete")
|
||||
rm "$FILE"
|
||||
notify-send "Screenshot deleted" "File removed"
|
||||
;;
|
||||
esac
|
||||
|
||||
Reference in New Issue
Block a user