screenshot 761 B

1234567891011121314151617181920
  1. #!/bin/sh
  2. directory="$HOME/pictures/screenshots/$(date +%Y)/$(date +%m)"
  3. filename="$directory/$(date +%d-%H%M%S).png"
  4. command="import -window root $filename"
  5. for arg; do
  6. case $arg in
  7. -s) command="import -window root -crop $(slop -f %g) $filename" ;;
  8. -w) command="import -window $(xdotool getmouselocation --shell | sed -n 's/WINDOW=//gp') $filename" ;;
  9. -u) upload=true ;;
  10. esac
  11. done
  12. mkdir -p $directory
  13. eval $command
  14. if [ "$upload" = true ]; then
  15. url="$(curl -sL -F files[]=@$filename https://file0.s3kr.it/upload | sed -n 's@.*https*://file0.s3kr.it/@https://file0.s3kr.it/@;s@'\'')">@@p')"
  16. printf "$url" | xsel -bpsi
  17. exiftool -overwrite_original -url=$url $filename
  18. notify-send "Screenshot succesful." "$filename -> $url." -i "$filename"
  19. fi