diff options
author | Suleyman Farajli <suleyman@farajli.net> | 2024-07-23 21:23:07 +0400 |
---|---|---|
committer | Suleyman Farajli <suleyman@farajli.net> | 2024-07-23 21:23:07 +0400 |
commit | 82f45dea7050948430888b7de0cb30ed250d754f (patch) | |
tree | 0be69106c21cb6f088c84b430a3b9a28c9339da1 /scripts | |
parent | eeab24db73ea89e7c1612a4ed81041cf31114f4d (diff) |
shot script added
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/shot | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/scripts/shot b/scripts/shot new file mode 100755 index 0000000..f99f28d --- /dev/null +++ b/scripts/shot @@ -0,0 +1,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; } |