I use screenshots a lot, every day. Mostly when I do instant messaging, they can usually help explain something much quicker than anything else. It’s rare that I edit the screenshot, and in these rare occasions, it doesn’t bother me all that much having to fire up Pinta or Gimp–to make these small changes.
shoot’s dependencies are:
You probably have those already, if not, install them via your package manager.
~/bin is in your
$PATH, you’re ready to
I recommend that you bind the script to a key, so you can easily activate it.
Coming up with the script
The functionality needed, came down to this:
- Select region and take screenshot of this region
- Upload screenshot to Imgur
- Put direct link to screenshot into the clipboard
Taking a screenshot of a specified region is quite easy with
curl to upload the picture, via the Imgur API:
This returns some XML containing, among other things, the direct URL to the uploaded screenshot, which we extract from the returned XML with a simple regex:
Now we have the direct link, and then it’s simply a matter of putting this all into the clipboard with
Now this is optional, but quite handy. It uses
libnotify to notify you when the image is uploaded, and ready to be pasted:
And I compiled all this into this simple script (I’m aware that this can be a one-liner and everything but this just seems more readable and works. If you have a better solution, be sure to contact me!):
That’s it. Hopefully you’ll enjoy it as much as I do.