some minor improvements

This commit is contained in:
speedie 2023-02-07 21:14:22 +01:00
parent 6dcdedef67
commit bfc9cd017b

View file

@ -48,6 +48,9 @@ CONFIG
# make default screenshot path
mkdir -p "$DEFAULT_SCREENSHOT_DIRECTORY"
# remove just in case
rm -f /tmp/screenshot*
# Help argument action
HELP() {
printf "speedwm-screenshotutil\n\n"
@ -74,11 +77,11 @@ case "$1" in
esac
# user action
[ -e "/tmp/screenshot-$DATE" ] && U_INPUT="$(printf "Image\nURL\nSave" | $RUNLAUNCHER -l 3 -p "Copy to clipboard as an: ")" || exit 1
[ -e "/tmp/screenshot-$DATE" ] && U_INPUT="$(printf "PNG\nURL\nSave\n" | $RUNLAUNCHER -l 3 -p "Copy to clipboard as:")" || exit 1
# perform actions based on user input
case "$U_INPUT" in
"Image") cat "/tmp/screenshot-$DATE" | xclip -selection clipboard -t image/png && SENDNOTIF "Screenshot copied to clipboard." ;;
"PNG") cat "/tmp/screenshot-$DATE" | xclip -selection clipboard -t image/png && SENDNOTIF "Screenshot copied to clipboard." ;;
"URL") printf "\n" | xclip -selection clipboard && UPLOAD_IMAGE "/tmp/screenshot-$DATE" | xclip -selection clipboard && SENDNOTIF "Screenshot copied to clipboard." ;;
"Save") SAVEDIR=$(printf "%s/screenshot-%s.png" "$DEFAULT_SCREENSHOT_DIRECTORY" "$(date "$FORMAT" | sed "s|:|-|g" | sed "s|/||g")" | $RUNLAUNCHER -l 1 -g 1 -p "Where do you want to save it? (Including filename)") && cat /tmp/screenshot-"$DATE" > "$SAVEDIR" && SENDNOTIF "Screenshot saved to $SAVEDIR" ;;
"") rm -f "/tmp/screenshot*"; exit 0 ;;