Now checks that screenshot worked before notifying

master
Jonathan Hodgson 4 years ago
parent ffcb63d5a5
commit 288215593d
  1. 16
      bin/.bin/screenshot

@ -22,6 +22,8 @@ fi
filename="$(date +"%Y-%m-%dT%H-%M-%SZ").png" filename="$(date +"%Y-%m-%dT%H-%M-%SZ").png"
file="${path}/${filename}" file="${path}/${filename}"
[ "$1" = "-w" ] && sleep "$2" && shift && shift
case $1 in case $1 in
"window") "window")
maim -i $(xdotool getactivewindow) "$file" maim -i $(xdotool getactivewindow) "$file"
@ -35,9 +37,11 @@ case $1 in
;; ;;
esac esac
# Copies the image to your clipboard (ctrl + v) if [ -f "$file" ]; then
xclip -selection clipboard -target image/png -i "$file" # Copies the image to your clipboard (ctrl + v)
# Copies the filename to primary selection (shift + insert or middle mouse) xclip -selection clipboard -target image/png -i "$file"
echo -n "$file" | xclip -selection primary # Copies the filename to primary selection (shift + insert or middle mouse)
# Creates notification with file name echo -n "$file" | xclip -selection primary
command -v notify-send > /dev/null && notify-send "New Screenshot" "$file" # Creates notification with file name
command -v notify-send > /dev/null && notify-send "New Screenshot" "$file"
fi

Loading…
Cancel
Save