Advertisement
Xpander69

Untitled

Feb 16th, 2014
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.20 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 and notify-send
  7. #date function
  8. DATE=`which date`
  9. # Settings:
  10. # Dropbox public folder location (add / to the end)
  11. dropbox=$HOME"/Dropbox/Public/"
  12.  
  13. # ID that appears on the public links
  14. publicID='28788188'
  15.  
  16. # File name format. (Just make sure there is some variables that change so screens won't get overwritten)
  17. filename="screen_`$DATE +%d%m%Y_%H.%M.%S`"
  18.  
  19. # Work starts here:
  20. # Scrot takes screenshot
  21.  
  22. if [[ $# -eq 1 ]]; then
  23. case $1 in
  24.     "-f")
  25.     scrot "$dropbox""$filename".png;;
  26.     "-b")
  27.     scrot -s -b "$dropbox""$filename".png;;
  28.     "-w")
  29.     scrot -s "$dropbox""$filename".png;;
  30.     *)
  31.     echo "Wrong option";;
  32.     esac
  33. fi 
  34.  
  35. # Public link into clipboard
  36. echo https://dl.dropboxusercontent.com/u/"$publicID"/"$filename".png | xclip -selection c
  37. # Send notification about work done here after filecheck
  38. cd $dropbox
  39. if [-f $filename];
  40. then notify-send --icon=monitor "Screenshot taken and address copied to clipboard" -t 2000;
  41. else notify-send "Failed to Create file" -t 2000;
  42. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement