Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 40 lines (32 sloc) 738 Bytes
#!/bin/bash
# take a screenshot
# usage: shot [select|focused] [path|data]
OPTS=""
FNAME=~/docs/shots/$(date +%F-%T).png
# if nothing specified, assume dmenu
if [ -z $1 ]; then
DMENU=true
choice=$(echo -e "full\nregion\nfocused" | dmenu -i -p "shot")
else
DMENU=false
choice=$1
fi
case $choice in
"region") OPTS="-s";;
"focused") OPTS="-i $(xdotool getactivewindow)";;
# 1s delay for dmenu to go away
"full") OPTS="-d 1";;
*) exit 1;;
esac
maim $OPTS $FNAME
notify-send "screenshot saved to $FNAME"
if $DMENU; then
choice=$(echo -e "path\ndata" | dmenu -i -p "copy")
else
choice=$2
fi
case $choice in
"path") echo "$FNAME" | xsel -b;;
"data") imgclip "$FNAME" &;;
*) ;;
esac