screenshot 787 B

123456789101112131415161718192021222324252627
  1. #!/bin/bash
  2. DIR="$HOME/.config/i3"
  3. rofi_command="rofi -theme $DIR/rofi/themes/screenshot.rasi"
  4. # Options
  5. screen=""
  6. area=""
  7. window=""
  8. # Variable passed to rofi
  9. options="$screen\n$area\n$window"
  10. chosen="$(echo -e "$options" | $rofi_command -p 'Screenshot' -dmenu -selected-row 1)"
  11. case $chosen in
  12. $screen)
  13. sleep 1; scrot 'Screenshot_%Y-%m-%d-%S_$wx$h.png' -e 'mv $f $$(xdg-user-dir PICTURES) ; viewnior $$(xdg-user-dir PICTURES)/$f'
  14. ;;
  15. $area)
  16. scrot -s 'Screenshot_%Y-%m-%d-%S_$wx$h.png' -e 'mv $f $$(xdg-user-dir PICTURES) ; viewnior $$(xdg-user-dir PICTURES)/$f'
  17. ;;
  18. $window)
  19. sleep 1; scrot -u 'Screenshot_%Y-%m-%d-%S_$wx$h.png' -e 'mv $f $$(xdg-user-dir PICTURES) ; viewnior $$(xdg-user-dir PICTURES)/$f'
  20. ;;
  21. esac