3 sshot is a simple script to make a screenshot!
10 Did you know that getopts is a built-in? The first version of this
11 script used getopt, but it was ugly and required some shell features
12 which I'm not sure are POSIX. getopts is easier to handle:
14 while getopts cs name; do
18 ?) echo "Usage: $0 [-s]" >&2; exit 1 ;;
22 The usage is simple, it just accepts a -c flag to copy the image in the
23 clipboard and a -s flag to select a window instead of grabbing the whole
26 The image is saved in /tmp/YYYYMMDDHHMMSS.png
28 file=/tmp/`date +%Y%m%d%H%M%S`.png
30 if [ -n "$select" ]; then
36 During the "select" maim aborts if a key is pressed; this however leaves
37 a zero-byte file around, something I don't really like, so remove it in
42 notify-send "sshot: aborted"
46 Optionally save the image in the clipboard: (not the path, the whole
49 if [ -n "$clip" ]; then
50 xclip -selection clipboard -t image/png -i "$file"
53 Then send a notification to give a feedback of the success
55 notify-send "sshot: done" "$file"