AUG
11
2015

KSnapshot-Next

KSnapshot is getting an overhaul.

It's actually a little more complicated than that. I started to work on the KF5 port of KSnapshot (EDIT: no, contrary to what Phoronix claims this port is not my work; I simply wanted to fix anything that needed fixing) sometime in early March this year, before I realised that the codebase, while perfectly in order for being a X11-only screenshot taker for KDE (yes, KSnapshot actually has a complete and fairly decent KF5 port in its frameworks branch on KDE Git), was in need of a major overhaul if we were going to get proper Wayland support in.

To that effect, I started working on a completely new screenshot application, copying in the bits and pieces of code from KSnapshot that I could actually use. It's called KScreenGenie, and has been living in KDE's Git infrastructure for quite a long time. It's currently in KDE Review, and will be moved to KDE Graphics in time for the Applications 15.12 release. Not just that, it will be renamed to KSnapshot, so people upgrading their computers will seamlessly upgrade from KSnapshot to KSnapshot 2.0 a.k.a. KScreenGenie.

But KScreenGenie in its current form and with its current name is actually going to see a public release. The code in the master branch of the git repository is currently in doc and string freeze, and is actually considered stable enough for daily use. A distribution called KaOS already ships it, I've been using it as my primary screenshooting tool for months now, and other KDE developers have also spent time using and testing it and fixing minor issues. So barring major blocker bugs that pop up anytime soon, KScreenGenie 2.0.0 will be released (independently of the KDE Applications) on August 15, 2015.

If you're so inclined, here's a little bit of technical information on how KScreenGenie is different from KSnapshot. The biggest internal change is how pictures are actually acquired - instead of using Qt's built in screenshooting APIs, KScreenGenie uses the native API for the platform that it's running on. Currently, only one working platform backend exists, and that's for X11, using xcb. We use libkscreen for properly figuring out screen layout information so that we can take proper multi-monitor screenshots (we don't support Zaphod mode though). On Wayland, because the platform specific bits are so well separated from the platform-independent bits, the application starts up, but does not actually take a screenshot. The reason is that there's no stable API for taking screenshots in Wayland yet (Weston has its own API, and while some of KWin's screenshot effect APIs work, all don't), and thus we don't actually have a working Wayland image grabber yet.

A particularly nice user-facing feature is the ability to take screenshots of transient windows (pop-up menus, for example) along with the parent window. In KSnapshot, if you chose "Window Under Cursor" as your mode and hover over a pop-up menu, only the pop-up menu is captured (technically the pop-up menu is a X11 window). In KScreenGenie, we actually have code to detect if the window is a transient window and if so, we try to figure out who the parent window is and then take a composite shot of both the parent and the transient. Note though, that this currently only works with Gtk3 and Qt5 applications, since only these toolkits set the WM_TRANSIENT_FOR property on their pop-up windows, thus enabling us to figure out who their parent is.

I'm also currently working on a basic image editor integrated into KScreenGenie for editing and annotating screenshots within KScreenGenie itself. The code isn't online yet, since it's nowhere near even half-baked, but hopefully it'll be there by 15.12 or at the very most 16.04.

I'd like to encourage distributions to package KScreenGenie 2.0.0 in their primary repositories, and users to use it, test it and report bugs. Distribution packagers who do include KScreenGenie in their repositories do need to mark the KSnapshot package from Applications 15.12 as replacing, providing and obsoleting the KScreenGenie package though.

Happy clicking!

Comments

Nice! I'd like to suggest to remember previously selected "Open with" option an to select it next time by default:


By Victor at Wed, 08/12/2015 - 12:42

I like it, that a basic image editor is going to be part of the kscreengenie. Hopefully it has sufficient features, like; adding nice looking arrows, cut out part of the image, draw a square or circle/oval to mark important parts in the image, write text... If that would all be part of the basic image editor it would be awesome.


By Richard at Wed, 08/12/2015 - 12:57

Can you elaborate why you're not using the qt apis?


By M__T at Wed, 08/12/2015 - 13:49

Two things. One, the only usable API Qt provides for taking screenshots is the full-screen screenshot API; we need to take shots of individual windows, or composites of multiple windows too. Secondly, even this single API won't work on Wayland, so we'll need to use native methods there. So we might as well use native methods everywhere.


By Boudhayan Gupta at Sat, 08/15/2015 - 11:28

What is the rationale behind the new layout? (I have a slight preference towards the old one, not saying that this one is bad or anything)


By Ivan at Wed, 08/12/2015 - 18:37

Most screens these days are wider than they are tall. That said, this look may change, which I will most probably decide on after seeing how the image editor turns out.


By Boudhayan Gupta at Sat, 08/15/2015 - 11:26

If you plan on using the horizontal orientation, please make the right hand side (Capture Mode, Content Options) more compact. The best thing a screenshot tool can do is get out of the way so that it doesn't obscure other windows (e.g. in case the desktop needs to be rearranged slightly after a subpar capture). (Note that recent Windows/OSX have minimalistic screenshot tools -- sometimes they hit the mark). The whitespace must go!


By Randy at Mon, 08/24/2015 - 13:26

Hi Boudhayan,

I can't find a place to report KScreenGenie bug in bugzilla, so I'll put it here.

I found I cannot make a screenshot of a KScreenGenie window using another KScreenGenie instance.
Also It would be better if I can use only one KscreenGenie instance to capture its own window.

Thanks.


By Yue at Sat, 08/15/2015 - 06:14

Bugs can now be reported against KSnapshot, component KScreenGenie.

As for making KSG shoot itself, I could add a "Do not hide window" option in content options for the next release.


By Boudhayan Gupta at Sat, 08/15/2015 - 11:22

Thank you for creating and maintaining a screenshot utility for KDE! Applications like these are very much why I love using KDE, with their stylish layout, ease of use and last but not least a bunch of functionality. KSnapshot was no different, so I'm glad to see its legacy move on to Qt 5!

For anyone curious to try out KScreenGenie already today, I compiled a list of dependencies you may require to compile it, e.g. on Kubuntu 15.10. This isn't a well maintained or complete list, but it should give you an idea while we wait for it to be packaged.

Source code:
- http://download.kde.org/stable/kscreengenie/2.0/src/

Inspired by the PKGBUILD over at the Arch AUR, building it could be done in the following fashion:
- https://projects.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/kscreengenie

$ cmake kscreengenie-2.0.1/ -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_LIBDIR=lib -DKDE_INSTALL_USE_QT_SYS_PATHS=ON
$ sudo make install

The dependencies I installed:
(Fair warning, many of these might not be required)

cmake extra-cmake-modules kdoctools-dev kdoctools5 libkf5config-dev libkf5config-dev libkf5configcore libkf5configcore5 libkf5configwidgets-dev libkf5configwidgets5 libkf5coreaddons libkf5coreaddons-dev libkf5coreaddons-dev libkf5coreaddons5 libkf5kiocore5 libkf5kiowidgets5 libkf5notifications-dev libkf5parts-dev libkf5parts-dev libkf5parts-plugins libkf5parts5 libkf5screen-dev libkf5xmlgui-dev libqt5x11extras5-dev libxcb-cursor-dev libxcb-image0-dev libxcb-render0 libxcb-render0-dev libxcb-shape0 libxcb-shape0-dev libxcb-shm0 libxcb-shm0-dev libxcb-util-dev libxcb1{,-dev} pkgconf qt5-default qt5-qmake qt5-qmake xcb xcb-proto xcb-util-cursor

In action:
- https://i.imgur.com/3LLwM1D.png

Enjoy!


By Tim Sæterøy at Sun, 11/01/2015 - 18:56

Pages