The New KDE Power Management System – fresh from Madrid
Hello from Madrid, where the last day of Solid sprint has just taken off (well, at least for me).
Yesterday, while you were in your beds, an insane commit hit trunk, bringing to KDE 4.6 the new generation of KDE’s Power Management System, formerly known as PowerDevil.
New name, new features, less code!
PowerDevil has been written quite some years ago, and my not so extensive experience at the time brought to some design flaws which were making the daemon less and less maintainable every release. Hence the need to rework the daemon’s core itself to provide a better and more stable concept. This has lead to the creation of KDE Power Management System. We chose this generic name for making the service more discoverable to the user, but the old PowerDevil name is still kept as in the C++ namespace name in the source code, and in the library files. So KDE Power Management System == PowerDevil.
A completely modular design…
One of the main issues we were facing was that we kept adding features on features, but yet PowerDevil’s code paths were rather complex and extremely modular – breaking something was very easy indeed. PowerDevil’s design is now based on Actions. Actions are a set of plugins which can perform a single power management task: suspending the session, controlling brightness, etc. So right now PowerDevil’s core is just a mere “controller” system, which takes care of triggering actions when needed. The size of the core is less than 1/10th of the previous core, you can tell it’s much more maintainable now.
…which you can obviously extend
If you were guessing, the answer is yes: you can write your own action plugins for PowerDevil and bring your very own power management features to your desktop. This means that, for example, hardware vendors can ship plugins for PowerDevil which are able to trigger power management features in their hardware, or advanced users with C++ knowledge can really make power management as they see fit. Of course the actions available in PowerDevil in KDE 4.5 have been ported to the new structure already.
And a new Config UI
Screenshots are worth a thousand words:
Nicer, isn’t it? It will get some further UI love from Sebastian in the next days to make it really shine, but what is really outstanding is that nothing is hardcoded: all the widgets you see come straight from the actions’ plugins. So yes: if you’re extending powerdevil through plugins, the configuration will actually look exactly like all the others. And you noticed it is now possible to disable actions: so to all the users who requested not to change brightness when switching plugins: here’s to you!
No more Solid::Control
Solid::Control is getting deprecated, so now PowerDevil has its own backends, which are a stripped version of Solid::Control ones, and no longer depends on Solid::Control::PowerManager, which will be hopefully removed for 4.6. An UPower backend is coming and will make its way into 4.6.
Real inhibition features
Ever got pissed off because notifications are cluttering your screen while you’re watching a movie, or your PC is suspending while doing updates, or your screen turns off while you’re in front of the PC? PowerDevil features a brand new Policy Agent, which will allow to have proper inhibition. We are still working on having this feature done right, but I am confident we will bring it to the table for 4.6.
The bad things
Unfortunately (as you can imagine), old PowerDevil profiles are no longer compatible with the new KDE Power Management system, so if you had something fancy you’ll probably need to create your profiles again (or try hacking up a conversion patch). By the way, more sensible defaults will be provided for 4.6, so you should be actually fine without changing profiles at all.
All cool, but does it work?
Trunk already features the new KDE Power Management System, but there are some feature regressions as not everything has been implemented yet, but I can say 80-90% of what’s needed is in. Today we’re going to make the applet play nice with the daemon, and if you want to test all of this goodness, I’d really advise you to wait until tomorrow.
Those are the main things, but many many more small ones have been done/fixed, to improve your desktop usage and not getting in your way. Hopefully I got you interested, so look forward to a vastly improved power management experience in 4.6!
~ by Dario on 3 October, 2010.