mass update.
[my-dotfiles.git] / bin / i3-scrot
CommitLineData
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
8if ! [ -f $_conf ]; then
9 echo "scrot_dir=$(xdg-user-dir PICTURES)" > $_conf
10fi
11
12source $_conf
13
14if ! [ -d $scrot_dir ]; then
15 mkdir -p $scrot_dir
16fi
17
18if ! [[ -z "$2" ]]; then
19 cmd="scrot -d $2"
20else
21 cmd='scrot'
22fi
23
24case "$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 "
40available options:
41-d | --desk full screen
fdd76fc5 42-s | --select selection
43-h | --help display this information
44
7abef725 45All options can be used with a delay
fdd76fc5 46by adding the number of seconds, like for example:
7abef725 47'i3-scrot -d 5'
fdd76fc5 48
49Default option is 'full screen'.
50
51The file destination can be set in ${_conf}.
52Default is $scrot_dir
53"
54 ;;
55 *)
56 echo "
57== ! i3-scrot: missing or wrong argument ! ==
58
59available options:
60-d | --desk full screen
fdd76fc5 61-s | --select selection
62-h | --help display this information
63
64Default option is 'full screen'.
65
66The file destination can be set in ${_conf}.
67Default is $scrot_dir
68"
69
70 exit 2
71esac
72
73exit 0