screenshot.sh 523 B

1234567891011121314151617181920212223242526
  1. #!/bin/sh
  2. screenshot_notification(){
  3. convert "$1" png:"$HOME/.cache/temp_screen.png"
  4. dunstify -h string:x-dunst-stack-tag:screenshot -A "open,open" "Qtile" "Screenshot Taken" -I "$HOME/.cache/temp_screen.png"
  5. rm ~/.cache/temp_screen.png
  6. }
  7. if [ "$2" = "True" ]; then
  8. scrot -F "$1"
  9. elif [ "$3" = "True" ]; then
  10. scrot -s "$1"
  11. else
  12. scrot --focused "$1"
  13. fi
  14. action=$(screenshot_notification "$1")
  15. if [ "$4" = "True" ]; then
  16. bzip2 "$1"
  17. name="$1.bz2"
  18. else
  19. name="$1"
  20. fi
  21. if [ "$action" = "open" ]; then
  22. nsxiv "$name"
  23. fi