blob: f99f28d3da453fb9d10fb312eb2c4f9b77d97bbf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#!/bin/sh
help() {
cat << EOF
$0: Wrapper script to take screenshots
options:
-s Select the area with the cursor
-h Print this message and exit
NOTE: save directory is ~/pic/screenshots
EOF
}
directory="${XDG_CONFIG_HOME:-$HOME}/pics/screenshots"
[ -d "$directory" ] || { mkdir -p "$directory" || echo "failed to create directory" >&2; }
filename="$directory"/%b%d::%H%M%S.png
while getopts "sh" option; do
case $option in
s) FLG="-fs" ;;
h) help ; exit 0 ;;
*) echo "$0 -h for help"; exit 1 ;;
esac
done
scrot $FLG -z $filename > /dev/null 2>&1 || { echo Screenshot failed; exit 1; }
|