| 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 | --window|-w) |
| 32 | cd $scrot_dir |
| 33 | $cmd -u && |
| 34 | sleep 1 && |
| 35 | notify-send "screenshot has been saved in $scrot_dir" |
| 36 | ;; |
| 37 | --select|-s) |
| 38 | cd $scrot_dir |
| 39 | notify-send 'select an area for the screenshot' & |
| 40 | $cmd -s && |
| 41 | sleep 1 && notify-send "screenshot has been saved in $scrot_dir" |
| 42 | ;; |
| 43 | --help|-h) |
| 44 | echo " |
| 45 | available options: |
| 46 | -d | --desk full screen |
| 47 | -w | --window active window |
| 48 | -s | --select selection |
| 49 | -h | --help display this information |
| 50 | |
| 51 | The -d or -w options can be used with a delay |
| 52 | by adding the number of seconds, like for example: |
| 53 | 'i3-scrot -w 5' |
| 54 | |
| 55 | Default option is 'full screen'. |
| 56 | |
| 57 | The file destination can be set in ${_conf}. |
| 58 | Default is $scrot_dir |
| 59 | " |
| 60 | ;; |
| 61 | *) |
| 62 | echo " |
| 63 | == ! i3-scrot: missing or wrong argument ! == |
| 64 | |
| 65 | available options: |
| 66 | -d | --desk full screen |
| 67 | -w | --window active window |
| 68 | -s | --select selection |
| 69 | -h | --help display this information |
| 70 | |
| 71 | Default option is 'full screen'. |
| 72 | |
| 73 | The file destination can be set in ${_conf}. |
| 74 | Default is $scrot_dir |
| 75 | " |
| 76 | |
| 77 | exit 2 |
| 78 | esac |
| 79 | |
| 80 | exit 0 |