Skip to content

Instantly share code, notes, and snippets.

@andrefs
Created April 5, 2013 22:21
Show Gist options
  • Save andrefs/5323149 to your computer and use it in GitHub Desktop.
Save andrefs/5323149 to your computer and use it in GitHub Desktop.
Screenshots directly to dropbox with public link in clipboard
#!/bin/bash
# Creates a screenshot from a region of the display,
# uploads it to Dropbox public folder and copies
# the link to the clipboard.
#
# Dependencies:
# xfce4-screenshooter
# dropbox
# x-clip
# notify-send
DATESTR=`date +%Y%m%d_%H%M%S`
TEMPSSDIR="/tmp/screenshots/$DATESTR"
SSDIR="$HOME/public_html/Dropbox/Public/screenshots"
SSNAME="$DATESTR.png"
mkdir -p "$TEMPSSDIR"
mkdir -p "$SSDIR"
xfce4-screenshooter -r -s "$TEMPSSDIR"
if ! [ -e "$TEMPSSDIR"/* ]; then
rm -r "$TEMPSSDIR"
exit 1
fi
mv "$TEMPSSDIR"/*.png "$SSDIR/$SSNAME"
rm -r "$TEMPSSDIR"
notify-send "Screenshot $SSNAME uploaded to Dropbox. Link is available in your clipboard."
LINK=`dropbox puburl "$SSDIR/$SSNAME"`
echo -n "$LINK" | xclip -i -selection clipboard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment