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.
Step 1: Dependencies
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:
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 don’t have them, check your distro’s repositories for the two programs. They are small and ubiquitous like leprechauns during the summer months:
Grab my screenie script here, and then
chmod +x the script to make it executable.
Step 3: Important!
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.
# Change DBUSER to match your Dropbox UID. For more intstructions, see above.
if [ -d $PUB ]
scrot -d 5 -q 100 $TIME.jpg
LAST=$(find . -cmin -1 -iname "*.jpg" | tail -n 1 | sed 's!.*/!!')
echo "$URL1/$DBUSER/$URL2/$LAST" | xclip -sel clip
Bonus step 4: Double Openbox laziness
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: