I used to run Compiz with KDE 3.5 and I quite liked that setup. Compiz was fast, highly (a bit too much, perhaps) configurable, and came with a great set of plugins. One of my favorite plugins was the screenshot plugin — basically it allowed me to capture arbitrary regions of the screen with a simple mouse+keyboard combo. This was particular useful when writing blogposts to demonstrate something on the desktop, when filing bug reports (to visually show what was going wrong), when telling webmasters what was wrong with their website (it makes everyone’s life easier if the screenshot only captures the problematic space on the page, not the entire window) and so on. The key strength of the plugin was that it was so easy to invoke, and the captured regions automatically got saved as PNGs to a pre-determined folder. Neat.
Unfortunately, with KDE4, I am no longer running Compiz since kwin (KDE’s native window manager) has built-in support for compositing now. KDE4 is great (especially with 4.2) but I still missed the screenshot plugin very much. I couldn’t find any equivalent plugins for KDE4, so I was on the lookout for a workaround. It turns out, there is one. Here is what you do:
- Go into System Settings -> Input Actions
- Create a new global shortcut (right click)
- Bind a convenient shortcut — I use Super+S or Meta+S
- For the command/URL, enter ‘kbackgroundsnapshot –region’ without the quotes, of course
And there you go — now you can simply press Super+S anywhere, anytime and the mouse cursor will change to a cross-bar. Once you have selected the region to capture, hit enter to save the picture, escape to cancel the action. By default the pictures are saved to your Desktop folder, and are named ‘snapshotX.png’ where X is some number. Here’s a screenshot that I just took:
What makes this work is the little-less known program (like so many other hidden gems in KDE) ‘kbackgroundsnapshot’. It is essentially ksnapshot, but it is supposed to run in the “background”, meaning that it doesn’t show the regular dialog box that ksnapshot shows. Useful for scripts and such.