New Dropbox hack: Automatic screenshot upload and URL

in code

Everybody takes a desktop screenshot at some point. For whatever reason. In the true spirit of computer geeks I spent two three hours writing and testing a shell script that will take a screenshot of your Linux desktop, upload the screenshot to the Internet via Dropbox and pop the URL into your clipboard for instant pasting without any interaction on your part.

To save you the thirty-or-so seconds it would take to do this by hand.

Laziness, distilled.

Step 1

First off, install Dropbox if you don’t already have it. You can grab it via the link above. Or the link below (daddy wants his referrals). This script relies on two other CLI programs that you may or may not have installed: scrot and xclip. A very easy way to see if you have them is to open a shell and type in: whereis scrot && whereis xclip. If you do not have them, check your distribution’s repositories for the two programs. They are small and ubiquitous like leprechauns during the summer months:

Step 2

Grab my screenie script here, and then chmod +x the script to make it executable.

Step 3

Third: IMPORTANT! After this you must open the script up in a text editor and modify the the $DBUSER variable to match your Dropbox UID:


You can find your Dropbox UID very easily from within your Dropbox folder or from on the Dropbox website. Navigate to your Public folder, right-click on any file and select “copy public URL” from the menu of options. Part of this URL is a numerical string. Replace CHANGEME with this string. As an example, my UID in the below URL for the script is “4144919”:

With all of those two, involved steps taken care of, you can run screenie locally or install it (as root) into your /usr/local/bin or equivalent folder for easy use.

Example screenshot


# Change DBUSER to match your Dropbox UID. For more instructions, see above.
TIME=$(date +%Y%m%d%H%M%S)
if [ -d $PUB ] 
    cd $PUB 
    mkdir $PUB 
    cd $PUB
sleep 1
scrot -d 5 -q 100 $TIME.jpg 
sleep 1
LAST=$(find . -cmin -1 -iname "*.jpg" | tail -n 1 | sed 's!.*/!!')
echo "$URL1/$DBUSER/$URL2/$LAST" | xclip -sel clip
exit 0

Step 4

If you are using Openbox you can take your laziness one step further by binding screenie to a keyboard shortcut. Push print screen. Twenty seconds later you have a smoldering hot URL in your clipboard yearning to be posted. Open up Openbox’s rc.xml file, usually to be found residing in ~/.config/openbox/, and add the following lines to the pertinent section:

<keybind key="Print">
    <action name="Execute">

Six Months in the Mountain Kingdom

in me

Your email address will not be published. Required fields are marked *