Automatically Take a Screenshot and Make it Public using Dropbox

If you already have Dropbox you already know that it has a Public folder where you can save files for everyone to download. If you are using the GUI version of Dropbox you can even right click on the file and get a public link to hand out. Although this works great, we can automate this process and make it easier.



You know the drill, grab your package manager and install a few things.

sudo apt-get install scrot gqview xclip

Create a file named, ‘’ and add the following:

#! /bin/sh

# Run this and it will take a screenshot of your desktop and optionally show it to you for confirmation
# Make sure you set the shotsdir to your dropbox public dir

delay=5 # set to 0 for no delay

file=$shotsdir/shot-`date +%Y-%m-%d-%H-%M-%S`.png
mkdir -p $shotsdir
scrot -d $delay $* $file
if xmessage -buttons "Yes:0,Nah:1" -default "upload" "Want to preview your image?"
    gqview $file
    echo -n "$dropboxURL/shots/"`basename $file` | xclip -i

Note: This script is based on a similar one by micah on reddit.

If your Dropbox folder is not in the default path you will need to change ‘shotsdir’. Also, change the dropboxid variable to match your Dropbox id. You can find your id buy right clicking on a file in the public folder and selecting Copy Public Link.

You can also change the ‘delay’ variable if you want to have a delay before the screenshot is taken. This will allow you to move windows around before the shot is taken.

The real beauty lies in the fact that the script will automatically put the public url in your clipboard. To paste it to a friend simply middle click!

Make an alias

Now it would be nice not to have to change directories and type in ‘sh’ all the time.

We can set up a bash alias by editing, ‘~/.bashrc’ and add the following line:

alias ds='sh /path/to/'

Now you can drop screenshots simply by typing ‘ds’ and hitting enter.

Of course you can pick any alias that fits your fancy. :)

comments powered by Disqus