diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/shot | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/bin/shot b/bin/shot new file mode 100755 index 0000000..91f3310 --- /dev/null +++ b/bin/shot @@ -0,0 +1,78 @@ +#!/bin/sh +set -eu + +usage() { + cat <<-'EOF' + Usage: + shot [-m] + shot -h + EOF +} + +help() { + cat <<-'EOF' + + + Options: + -m use the mouse to select the region to screen shot + -h, --help show this message + + + Take a screenshot. The default is to print the whole screen, but + the "-m" can be given to select only a part of the screen. + + The screenshots are saved to ~/Downloads/Screenshots/ + + + Examples: + + Take screenshot of the full screen: + + $ shot + + + Select the region of the screenshot: + + $ shot -m + EOF +} + + +for flag in "$@"; do + case "$flag" in + --) + break + ;; + --help) + usage + help + exit + ;; + *) + ;; + esac +done + +OPTS= +while getopts 'mh' flag; do + case "$flag" in + m) + OPTS='-s' + ;; + h) + usage + help + exit + ;; + *) + usage >&2 + exit 2 + ;; + esac +done +shift $((OPTIND - 1)) + +TEMPLATE=~/Downloads/Screenshots/%Y-%m-%dT%H:%M:%S.png + +scrot $OPTS "$TEMPLATE" +msg -D "screenshot saved on ~/Downloads/Screenshots/" |