Created
February 7, 2014 01:30
-
-
Save taylor/8855939 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # uses scrot for capture | |
| # and imgur for posting | |
| post=0 | |
| scrotargs="" | |
| selectopt="-s" | |
| filename='%Y-%m-%d-%H%M_$wx$h.png' | |
| execcmd="imgur" | |
| postex="" | |
| function usage() { | |
| me=$(basename $0) | |
| echo "$me [options] [scrot options]" | |
| echo "Options for $me:" | |
| echo " -i|-imgur|-p|-u - Upload to imgur.com" | |
| echo " -s|-select - Select part of the screen" | |
| echo " -a|-all - Capture all of the screen (default)" | |
| echo " -t|-w|-wait - Wait 5 seconds before capture" | |
| echo " -h|-help|-usage - This help" | |
| } | |
| wait=0 | |
| while [ true ] ; do | |
| case "$1" in | |
| -h|-help|--help|-usage) | |
| usage | |
| exit | |
| ;; | |
| -i|-imgur|-p|-post|-u) | |
| postex="-e" | |
| shift | |
| ;; | |
| -s|-select) | |
| selectopt="-s" | |
| shift | |
| ;; | |
| -a|-all) | |
| selectopt="" | |
| shift | |
| ;; | |
| -t|-w) | |
| wait=5 | |
| shift | |
| ;; | |
| *) | |
| scrotargs="$scrotargs $1" | |
| shift | |
| ;; | |
| esac | |
| [[ -z "$1" ]] && break | |
| done | |
| scrotargs="$scrotargs $selectopt" | |
| if [ ! "$wait" = 0 ] ; then | |
| sleep $wait | |
| fi | |
| sleep 0.25 | |
| if [ -n "$postex" ] ; then | |
| exec scrot "$filename" $scrotargs $postex "$execcmd \$f" | |
| else | |
| exec scrot "$filename" $scrotargs | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment