From: Samir Benmendil Date: Sat, 6 Feb 2021 14:09:44 +0000 (+0000) Subject: bin: add maif, a wrapper around maim with auto filename X-Git-Url: https://git.rmz.io/dotfiles.git/commitdiff_plain/d6435fdf1c58744d256c2f99fd941626cae23319?ds=sidebyside bin: add maif, a wrapper around maim with auto filename --- diff --git a/bin/maif b/bin/maif new file mode 100755 index 0000000..e4e1d2a --- /dev/null +++ b/bin/maif @@ -0,0 +1,38 @@ +#!/usr/bin/env bash + +set -e + +version="0.1" + +function usage () +{ + echo "Usage : $0 [options] [FILE] + + MAke Image File + + Takes a screenshot using maim and saves it to FILE. If FILE is + not given it defaults to current timestamp, and geometry of + selection. + + Options: + -h,--help Display this message" +} + +# Parse arguments +declare -a args +while [[ $# -gt 0 ]]; do + opt="$1" + + case $opt in + -h|--help) usage; exit 0 ;; + -* ) + echo -e "\n Option does not exist : $opt\n" + usage; exit 1 ;; + + *) args+=("$opt"); shift ;; + esac +done + +geometry="$(slop)" +file="$(date "+%FT%T_${geometry%%+*}_maif.png")" +maim --geometry="${geometry}" $file