From 82f45dea7050948430888b7de0cb30ed250d754f Mon Sep 17 00:00:00 2001 From: Suleyman Farajli Date: Tue, 23 Jul 2024 21:23:07 +0400 Subject: shot script added --- scripts/shot | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 scripts/shot (limited to 'scripts') 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; } -- cgit v1.2.3