TheReverend403/Screenbash — pull request #2 by welbornprod (2014-09-02 01:09:49+00:00)
Title: Added ksnapshot support for kde.

To be honest, I probably won't use this program. I already have my own methods of quick and easy screenshots. Still, I thought it wasn't fair for it to only support `gnome-screenshot` (not installed on my system).

This patch adds support for `ksnapshot` (the KDE screenshot program). It actually uses `kbackgroundsnapshot` to do the work, because `ksnapshot` is strictly gui and will not accept a file name as an argument. `kbackgroundsnapshot` will create a screenshot using fullscreen, window, mouse-cursor, or as your program is already set up, a region. The region is selected in the same fashion as `gnome-screenshot`.

`kbackgroundsnapshot` doesn't accept a file name for an argument either. It actually creates a file named `~/Desktop/snapshot{auto-incremented-number}.png`.
This patch waits until screenshot completion, grabs the latest `snapshotN.png` name, and only *then* sets the `$FILE` variable for later use.

This patch also adds support for detecting whether the screenshot application is available. In other words,
if `gnome-screenshot` is available then use it. Otherwise, if `ksnapshot` is available then use it. Otherwise, print an error message and exit.

I won't blame you for not merging this. I just thought I would push it out there in case.