From 288215593d335aca0ca0fe29ea130c690eb47e89 Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Mon, 25 May 2020 12:05:23 +0100 Subject: [PATCH] Now checks that screenshot worked before notifying --- bin/.bin/screenshot | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/bin/.bin/screenshot b/bin/.bin/screenshot index c75d26de..ec7901b0 100755 --- a/bin/.bin/screenshot +++ b/bin/.bin/screenshot @@ -22,6 +22,8 @@ fi filename="$(date +"%Y-%m-%dT%H-%M-%SZ").png" file="${path}/${filename}" +[ "$1" = "-w" ] && sleep "$2" && shift && shift + case $1 in "window") maim -i $(xdotool getactivewindow) "$file" @@ -35,9 +37,11 @@ case $1 in ;; esac -# Copies the image to your clipboard (ctrl + v) -xclip -selection clipboard -target image/png -i "$file" -# Copies the filename to primary selection (shift + insert or middle mouse) -echo -n "$file" | xclip -selection primary -# Creates notification with file name -command -v notify-send > /dev/null && notify-send "New Screenshot" "$file" +if [ -f "$file" ]; then + # Copies the image to your clipboard (ctrl + v) + xclip -selection clipboard -target image/png -i "$file" + # Copies the filename to primary selection (shift + insert or middle mouse) + echo -n "$file" | xclip -selection primary + # Creates notification with file name + command -v notify-send > /dev/null && notify-send "New Screenshot" "$file" +fi