Advertisement
Interknet

Untitled

Feb 6th, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # This program takes screenshot, saves it into your screenshot folder
  4. # sends a desktop notification.
  5. # Made by woox2k & xpander
  6. # Depends on escrotum, notify-send and xdotool (grabs current window)
  7.  
  8. #date function
  9. DATE=`which date`
  10.  
  11. # Screenshot folder location (add / to the end)
  12. location=$HOME"/Pictures/"
  13.  
  14. # File name format. (Just make sure there is some variables that change so screens won't get overwritten)
  15. filename="ss_`$DATE +%d%m%Y_%H.%M.%S`"
  16.  
  17. # Send notification after file checking
  18. NotifyAction(){
  19. if ls -f "$location""$filename".png;
  20. then notify-send --icon=gnome-screenshot "Screenshot" "Screenshot taken" -t 2000;
  21. else notify-send --icon=error "Error" "Failed to Create file" -t 2000;
  22. fi
  23. }
  24.  
  25. if [[ $# ]]; then
  26. case $1 in
  27. "-d" | "--desktop" )
  28. escrotum -fC "$location""$filename".png && NotifyAction;;
  29. "-s" | "--select" )
  30. escrotum -sC "$location""$filename".png && NotifyAction;;
  31. "-w" | "--window" )
  32. currentWin=$(xdotool getactivewindow)
  33. escrotum -x "$currentWin" "$location""$filename".png && xclip -selection clipboard -t image/png "$location""$filename".png && NotifyAction;;
  34. * | "-h" | "--help" )
  35. echo -e "Usage: $0 [OPTION]\n"
  36. echo -e "\e[4mOption Long Option Purpose\e[0m"
  37. echo "-d --desktop Captures whole desktop - including other monitors."
  38. echo "-s --select Select a window to capture."
  39. echo "-w --window Captures active window."
  40. echo "-h --help Show this list of options";;
  41. esac
  42. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement