Advertisement
Guest User

screenshot

a guest
Apr 25th, 2018
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.22 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # This program takes screenshot, saves it into Mega folder
  4. # sends a desktop notification.
  5. # Made by woox2k & xpander
  6. # Depends on 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. mega=$HOME"/MEGA/"
  14.  
  15. # File name format. (Just make sure there is some variables that change so screens won't get overwritten)
  16. filename="ss_`$DATE +%d%m%Y_%H.%M.%S`"
  17.  
  18. # Work starts here:
  19. # option -f is full screenshot of the whole desktop (including multiple monitors)
  20. # option -b is a screenshot of pointed window, panel, gadget with window borders
  21. # option -w is a screenshot of focused window, panel, gadget
  22.  
  23. if [[ $# -eq 1 ]]; then
  24. case $1 in
  25.     "-f")
  26.     scrot "$mega""$filename".png;;
  27.     "-b")
  28.     import -frame "$mega""$filename".png;;
  29.     "-w")
  30.     scrot -u "$mega""$filename".png;;
  31.     *)
  32.     echo "Wrong option";;
  33.     esac
  34. fi 
  35.  
  36. # Send notification after file checking
  37. cd $mega
  38. if ls -f "$filename".png;
  39. then notify-send --icon=gnome-screenshot "Screenshot" "Screenshot taken" -t 2000;
  40. else notify-send --icon=error "Error" "Failed to Create file" -t 2000;
  41. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement