| 1 | #!/bin/sh |
| 2 | # /usr/bin/i3-scrot |
| 3 | # |
| 4 | # simple screenshot-script using scrot for manjaro-i3 by oberon@manjaro.org |
| 5 | |
| 6 | _conf=$HOME/.config/i3-scrot.conf |
| 7 | |
| 8 | if ! [ -f $_conf ]; then |
| 9 | echo "scrot_dir=$(xdg-user-dir PICTURES)" > $_conf |
| 10 | fi |
| 11 | |
| 12 | source $_conf |
| 13 | |
| 14 | if ! [ -d $scrot_dir ]; then |
| 15 | mkdir -p $scrot_dir |
| 16 | fi |
| 17 | |
| 18 | if ! [[ -z "$2" ]]; then |
| 19 | cmd="scrot -d $2" |
| 20 | else |
| 21 | cmd='scrot' |
| 22 | fi |
| 23 | |
| 24 | case "$1" in |
| 25 | --desk|-d|$NULL) |
| 26 | cd $scrot_dir |
| 27 | $cmd |
| 28 | sleep 1 |
| 29 | notify-send "screenshot has been saved in $scrot_dir" |
| 30 | ;; |
| 31 | --select|-s) |
| 32 | cd $scrot_dir |
| 33 | notify-send 'select a window or drag to select an area for the screenshot' & |
| 34 | $cmd -s |
| 35 | sleep 1 |
| 36 | notify-send "screenshot has been saved in $scrot_dir" |
| 37 | ;; |
| 38 | --help|-h) |
| 39 | echo " |
| 40 | available options: |
| 41 | -d | --desk full screen |
| 42 | -s | --select selection |
| 43 | -h | --help display this information |
| 44 | |
| 45 | All options can be used with a delay |
| 46 | by adding the number of seconds, like for example: |
| 47 | 'i3-scrot -d 5' |
| 48 | |
| 49 | Default option is 'full screen'. |
| 50 | |
| 51 | The file destination can be set in ${_conf}. |
| 52 | Default is $scrot_dir |
| 53 | " |
| 54 | ;; |
| 55 | *) |
| 56 | echo " |
| 57 | == ! i3-scrot: missing or wrong argument ! == |
| 58 | |
| 59 | available options: |
| 60 | -d | --desk full screen |
| 61 | -s | --select selection |
| 62 | -h | --help display this information |
| 63 | |
| 64 | Default option is 'full screen'. |
| 65 | |
| 66 | The file destination can be set in ${_conf}. |
| 67 | Default is $scrot_dir |
| 68 | " |
| 69 | |
| 70 | exit 2 |
| 71 | esac |
| 72 | |
| 73 | exit 0 |