fdd76fc5 |
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 |
7abef725 |
27 | $cmd |
28 | sleep 1 |
fdd76fc5 |
29 | notify-send "screenshot has been saved in $scrot_dir" |
30 | ;; |
31 | --select|-s) |
32 | cd $scrot_dir |
7abef725 |
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" |
fdd76fc5 |
37 | ;; |
38 | --help|-h) |
39 | echo " |
40 | available options: |
41 | -d | --desk full screen |
fdd76fc5 |
42 | -s | --select selection |
43 | -h | --help display this information |
44 | |
7abef725 |
45 | All options can be used with a delay |
fdd76fc5 |
46 | by adding the number of seconds, like for example: |
7abef725 |
47 | 'i3-scrot -d 5' |
fdd76fc5 |
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 |
fdd76fc5 |
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 |