Power management goodness: KDE 4.2 will suck less

Battery popup dialog
… power. As Dario has already blogged, we have a great new application in kdebase, scheduled to be released with KDE 4.2 in january. PowerDevil is actually not an application in the traditional sense. PowerDevil delivers the infrastructure for power management in KDE. This means it’ll notify you when your battery is running out, it dims your screen a bit when you’re idle to save some battery life, it switches to a lower power consumption state when you unplug the AC Adapter, it automatically suspends, hibernates or shuts down when your battery is (near) empty, that kind of stuff. For a user, it’s not a real application, but much more a service that handles some tasks for you and doesn’t get in the way.

Technically, powerdevil is designed to integrate with KDE’s platform-independant infrastructure. So while the actual tasks are very close to the hardware’s capabilities, powerdevil is not bound to Linux for example. The code is very portable, thanks to the Solid hardware abstraction. Naturally, PowerDevil uses knotify to tell the user about anything she needs to know, fine-grained control about all notifications is available in the System Settings module.

PowerDevil consists of the following parts:

  • A configuration dialogue in System Settings
  • A kded module that does the background work
  • A KRunner for command-line access to most functions
  • A Plasmoid for quick access to some popular functionality

During the last week, I’ve done some work on the plasmoid corresponding to powerdevil, and it starts to work nicely. In current KDE’s SVN trunk/, you can click on the battery plasmoid and you’ll see the dialogue in the screenshot. The idea (should be pretty clear, eh) is that you check some details on the battery status, quickly switch profile (when you want full performance on the road, for example), or re-adjust your brightness. The button at the bottom opens the PowerDevil settings module. The plasmoid still needs some polishing, but thanks to the input from Riccardo, Celeste and others, I think we’re pretty close to a smooth UI.
I’d also like to add a “do not suspend or screensave my system while I’m doing this presentation / watching this movie” button. We could implement that with a profile in powerdevil (but that wouldn’t cover the screensaver), or — and I think I prefer that option — with a “[x] Presentation Mode” checkbox. I figured, we should only prevent the system from suspending after an idle time. The system should still suspend (/ hibernate / shutdown / …) at the critical battery level. This critical level suspend should also go with some kind of count-down dialog, so you still have the opportunity to ‘… cancel that damn thing’ when you really do not want it to go away. Well, on the TODO. :)

Thanks to the awesome work of pinda, you can drag the battery’s pop-up control to the desktop and have it sit there as separate applet. There will be a button in the top-right corner in that case that moves this “extender” back into its original location (the battery applet’s popup). Neat-o.

Wacky detail, as you can see, the popup also shows the battery. I’ve loaded another (simplified) instance of the battery applet there, so that’s all animated and shiny. Thanks to the power of plasma’s dataengine, all the “getting data code” is shared between those applets anyway. UI-wise, the battery-in-panel is actually a subset of the “battery-extender-on-desktop”.

I’ve also done some performance tweaks to the runner (also in kdebase) that lets you control power management aspects. As we still haven’t implemented an easy way to find out about krunner syntax (I usually check the source code :/), here’s a quick list of things krunner + powerdevil now understand:

  • screen brightness 80 to set the brightness of your display
    (between 0 and 100)
  • suspend for various suspend methods
  • power profile to switch to a different profile
  • power governor for a list of CPU governors
  • power scheme for different schemes (note to self: find out what the difference between scheme and profile is ;-))
  • screen brightness (without number) to turn off and dim the screen

We should probably collect this knowledge on UserBase

In other power management news, we’ve also come quite far. Various people (among them Lubos) have done an awesome job making KDE suck less power. I’ve done some tests over the last months. Around KDE 4.0, the machine caused 700 – 900 wakeups per second, idle. Most of that (but not all) was caused by an issue in xine when using certain functions in phonon. Right now, we’re pretty much there. My idle system is down to around 100 wakeups per second, most of that caused by hardware (wifi, usb, sata, …). Something the kernel developers are working on. KDE (plasma + apps) accounts for 5 wakeups a second, the first KDE app comes in as 10th. To put those numbers in perspective: 100 wakeups per second is already pretty low. Everything below it is probably highly optimized. Even in compositing mode, when you’re not moving your windows KWin doesn’t suck extra power. Good news for mobile KDE users. :)

We are out of swordfish.

… which, in Greece is served as a main dish. So at a regular dinner, that’s after the second Ouzo, which is both refreshing and the kind of fun that flushes your java-fried brain pretty thoroughly.
As Ade already blogged we’re in Greece, just south of Athens (that’s where “50” inside a red ring on a road sign means “120 km/h is a good average, you have to fiddle with your navigation system after all at the same time”, at least in taxi drivers’ minds, apparently) for a SQO-OSS sprint, but also where the waiter happily shows you the fish you’re planning to have for dinner, and even gives it a name (in my dinner’s case “Papadopoulos”) on request. But let’s try to keep the “We are out of …” titled blogs void of sensible content … (respect tradition!)
On a totally unrelated note, today’s kudos go to Nuno for providing me with green, yellow and red variations of the Blue Curl wallpaper (the default KDE 4.1 one) they’re in the slideshow plasma rotation wallpaper plugin and making this world a better place (did I mention that I don’t have a real life? ;-)).
Concluding with today’s geek survival tip seems appropriate: If your mouse cursor behaves in very weird and unpredictable ways, if you see context menues popping up seemingly randomly and if you just have a really hard time pointing at anything: *do* check your short’s pockets to make sure you didn’t tuck your wireless mouse in there. Worked for me.