printscreen 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/bin/bash
  2. #changelog
  3. #v0.3
  4. #added 1. Notifications 2.unique names for each type (for quick launch) 3.better photo editor (pinta) 4.dmenu title
  5. #v0.4
  6. #1.Added variable for notification timeouts. 2. Show link in notification
  7. #Requires Scrot and a program to upload pictures somewhere
  8. IMG_PATH=/home/eddie/Pictures/
  9. UL=imgur
  10. EDIT=pinta
  11. TIME=3 #Seconds notification should remain visible
  12. prog="
  13. ---Local screenshots (saved at IMG_PATH)---
  14. 1.quick_fullscreen
  15. 2.delayed_fullscreen
  16. 3.section
  17. 4.edit_fullscreen
  18. ---Upload to remote service (images will be deleted)---
  19. a.upload_fullscreen
  20. u.upload_delayed_fullscreen
  21. e.edit_upload_fullscreen
  22. s.upload_section
  23. p.edit_upload_section
  24. "
  25. cmd=$(dmenu -p 'Choose Screenshot Type' <<< "$prog")
  26. cd $IMG_PATH
  27. case ${cmd%% *} in
  28. 1.quick_fullscreen) scrot -d 1 '%Y%m%d-%H%M%S.png' && notify-send -u low -t $TIME 'Scrot' 'Fullscreen taken and saved' ;;
  29. 2.delayed_fullscreen) scrot -d 4 '%Y%m%d-@%H%M%S.png' && notify-send -u low -t $TIME 'Scrot' 'Fullscreen Screenshot saved' ;;
  30. 3.section) scrot -s '%Y%m%d-@%H%M%S.png' && notify-send -u low -t $TIME 'Scrot' 'Screenshot of section saved' ;;
  31. 4.edit_fullscreen) scrot -d 1 '%Y%m%d-@%H%M%S.png' -e "$EDIT \$f" && notify-send -u low -t $TIME 'Scrot' 'Screenshot edited and saved' ;;
  32. a.upload_fullscreen) $UL \$f ;;
  33. u.upload_delayed_fullscreen) "$UL " ;;
  34. e.edit_upload_fullscreen) "$EDIT && $UL && rm -f" ;;
  35. s.upload_section) $UL ;;
  36. p.edit_upload_section) "$EDIT && $UL && rm -f" ;;
  37. *) exec ${cmd} ;;
  38. esac