Much ado about scripting, Linux & Eclipse: card subject to change


Capturing Screenshots Made Easy: Scripting With xfce4-screenshooter

Since moving to Fedora 10 and casting off my old ties to Kubuntu, I've been rather frustrated with the available options for capturing screenshots under Gnome.

I've tried the gnome-screenshot tool, docked as a panel applet, but it only allows me to capture the desktop or selected window. No click-and-drag region select?

When I've needed to capture only a part of my screen or overlapping windows (eg., Eclipse dialogs) I've been forced to capture the whole screen then crop it down w/ GIMP. Or, launch GIMP first and let it do the region capture - but GIMP never remembers my settings from last time, so to capture a region after a 2-second delay, it's 8 clicks every time I start GIMP. Lame.

In both cases, it's cumbersome, and I always have to select the directory where I want to save, and then name the file.

This weekend, I discovered xfce4-screenshooter, which is significantly better in that I can capture an area of the screen and auto-save to a file without needing to specify a filename each time.

It can even redirect the capture to an application or the clipboard rather than a file, and provides all the dialog options as commandline flags so it can be scripted, too.

So, now, I simply wrap that application with a bash script that runs the screenshooter then opens my snapshot folder with Thunar, so I can preview the result with Ristretto or edit it with GIMP if necessary. One click to start the process, one click-and-drag to create the image. And no unnecessary dialog configuration, file system browsing, or clicking!

Here's the scriptlet, which I've set up as a Gnome panel shortcut to run /home/nboldt/bin/

/usr/bin/xfce4-screenshooter -s /home/nboldt/Screenshots/ -h -r && \
  thunar /home/nboldt/Screenshots/ &

And here's my desktop, captured with only 2 clicks:

One might argue that it's too bad that these three tools can't just be merged into one. I'd argue that it's great that if you don't like one tool, you can find two others, each incrementally better than the next. Screenshot integration in GIMP is very handy, as is automatic capture to file (with incremental file naming). And, unlike in the Windows and Mac worlds, if the best tool for the job isn't available for one window system, I can simply cherry pick from another.

Still, nothing beats the feature set and usability of HyperSnap, but that's sadly a closed-source Windows application, and far from free. Proving that in this world, ultimately, you get what you pay for -- but there are some excellent free & open source alternatives.


Scott said...

Awesome background image. I'm just exactly in that mood this week lol. Could you provide a pointer as to where I could pick it up?

nickb said...

Search for this or similar JTHM images, or crop out the bits of my desktop that aren't part of the image with GIMP. Can't remember where I found this, I've had it for years.

Michael said...

What's wrong with ImageMagick commands:

1. import -window root desktop.png (Desktop screen-shot)
2. import window.png (Window screen-shot)

No mouse clicks at all :)

nickb said...

@Michael: sure, that works for desktop and current window, but I often need a selection (a few windows that overlap, or a piece of a window).