From bfc9cd017bab6e5e080e2cd92c6fa3a4878909b4 Mon Sep 17 00:00:00 2001 From: speedie Date: Tue, 7 Feb 2023 21:14:22 +0100 Subject: [PATCH] some minor improvements --- src/speedwm-screenshotutil | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/speedwm-screenshotutil b/src/speedwm-screenshotutil index bb4a9fd..eac65d2 100755 --- a/src/speedwm-screenshotutil +++ b/src/speedwm-screenshotutil @@ -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 ;;