Skip to content

Instantly share code, notes, and snippets.

@BHSPitMonkey
Created September 24, 2010 15:09
Show Gist options
  • Save BHSPitMonkey/595524 to your computer and use it in GitHub Desktop.
Save BHSPitMonkey/595524 to your computer and use it in GitHub Desktop.
# DropShot
# Takes a screenshot of a selection and posts to Dropbox
# Combine with GNOME DO or a panel shortcut for maximum win
PUBLICPATH=~/Dropbox/Public/
SUBDIR=DropShot/
SUBDIRPATH=$PUBLICPATH$SUBDIR
FILENAME=`date +"%Y-%m-%d--%H-%M-%S"`.png
# Check for dependencies (dropbox, scrot, xclip)
failed_dep=0
if ! which dropbox > /dev/null; then echo "Please install dropbox or make sure it is in your path."; failed_dep=1; fi
if ! which scrot > /dev/null; then echo "Please install scrot or make sure it is in your path."; failed_dep=1; fi
if ! which xclip > /dev/null; then echo "Please install xclip or make sure it is in your path."; failed_dep=1; fi
echo $failed_dep
if ! failed_dep==1; then echo "exiting"; exit; fi
# Ensure destination folder exists and go there
mkdir -p $SUBDIRPATH
cd $SUBDIRPATH
# Magic!
scrot -s "$FILENAME"
sleep 1
dropbox puburl "$FILENAME" | xclip -sel clip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment