all repos — dotfiles @ a9d88fbd77f9981feebf5d0e6b84f588d239c028

my *nix dotfiles

bin/scr (view raw)

 1#!/usr/bin/env bash
 2# scr: screenshot tool
 3
 4scr_path=~/pics/scrots
 5n=6; output=$(tr -cd '[:alnum:]' < /dev/urandom | head -c$n)
 6
 7usage() {
 8    echo "usage:"
 9    echo "  scr [option]"
10    echo "options:"
11    echo "  -f    full screenshot"
12    echo "  -w    window screenshot"
13    echo "  -s    selection screenshot"
14}
15
16while getopts fws option
17do
18    case $option in
19        f)
20            import -window root "$scr_path/$output.png"
21            ;;
22        w)
23            import -window "$(xdotool getwindowfocus)" "$scr_path/$output.png"
24            convert "$scr_path/$output.png" \( +clone -background transparent -shadow 60x40+0+15 \) \
25	        +swap -background white -layers merge +repage "$scr_path/$output.png"
26            ;;
27        s)
28	        import "$scr_path/$output.png"
29            ;;
30        * | ?)
31            usage
32            exit;;
33        esac
34done
35
36if [ $OPTIND -eq 1 ]; then
37    echo "scr: missing argument"
38    usage
39    exit
40fi
41
42
43xclip -selection clipboard -t image/png -i "$scr_path/$output.png"
44cp "$scr_path/$output.png" "$scr_path/latest.png"