Advertisement
Guest User

Untitled

a guest
Mar 31st, 2015
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # This program takes screenshot, saves it into Dropbox public folder
  4. # sends a desktop notification and copies the public link into the clipboard.
  5. # Made by woox2k & xpander
  6. # Depends on xclip, scrot, notify-send and optionaly imagemagick for taking shots of specific windows
  7.  
  8. #date function
  9. DATE=`which date`
  10.  
  11. # Dropbox public folder location (add / to the end)
  12. dropbox=$HOME"/Dropbox/Public/"
  13.  
  14. # ID that appears on the public links
  15. publicID='28788188'
  16.  
  17. # File name format. (Just make sure there is some variables that change so screens won't get overwritten)
  18. filename="ss_`$DATE +%d%m%Y_%H.%M.%S`"
  19.  
  20. # Work starts here:
  21. # option -f is full screenshot of the whole desktop (including multiple monitors)
  22. # option -b is a screenshot of pointed window, panel, gadget with window borders
  23. # option -w is a screenshot of pointed window, panel, gadget without window borders
  24.  
  25. if [[ $# -eq 1 ]]; then
  26. case $1 in
  27. "-f")
  28. scrot "$dropbox""$filename".png;;
  29. "-b")
  30. import -frame "$dropbox""$filename".png;;
  31. "-w")
  32. import "$dropbox""$filename".png;;
  33. *)
  34. echo "Wrong option";;
  35. esac
  36. fi
  37.  
  38. # Send notification after file checking
  39. cd $dropbox
  40. if ls -f "$filename".png;
  41. then notify-send --icon=gnome-screenshot "Screenshot" "Screenshot taken and address copied to clipboard" -t 2000;
  42. else notify-send --icon=error "Error" "Failed to Create file" -t 2000;
  43. fi
  44.  
  45.  
  46. # Public link into clipboard
  47. echo https://dl.dropboxusercontent.com/u/"$publicID"/"$filename".png | xclip -selection c
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement