Battery Applet – The Sequel

There have been quite some comments to my previous blog, among them some good points how to further improve the clarity of the battery applet’s info and control panel. I thought the best way to address this is with a patch, and a bit of explanation of those changes. So here’s the dialogue after a bit of further hacking on it:

New version on the left, old version on the rightLet’s look at the latest changes:

  • Bigger informational text, bold labels — Checking the charging state is the primary usecase of the panel, adding a bit of visual weight to the top section makes it easier to spot the information
  • Separator between info section and controls removed — As some people pointed out, the separator between the info and the control section resembles the brightness slider a bit too closely, and distracts visually
  • Configure button moved in line with the profile combobox — This is actually a very good point. It makes sense to put the configure button next to the profile combobox. The button actually leads to the profile configuration settings. It also makes it possible to …
  • Move Sleep and Hibernate buttons in line — Now we have two instead of three buttons in the lower section of the controls, we can actually put them in line and get rid of the large hole in the lower part of the dialog.
  • Aligned labels and controls horizontally — This last one is a label alignment bug in my code notmart quickly fixed after seeing the screenshot. Thanks dude! :)

I think that it works indeed better visually with those changes. The separation between info section and controls are better, the alignment of the widget overall is clearer, and as you can see, we’ve also saved quite some horizontal space. While it’s certainly not perfect yet, I think it’s a really nice improvement. Thanks to those who came up with the suggestions. I’ve just committed the patches to trunk, so they’ll be in KDE SC 4.4 beta next week.

On a sidenote, I had to order a new battery today for my beloved Thinkpad T60. The battery I’m using is, as you can see totally worn out. If you, dear lazyweb have suggestions how I can revive my (by now three) worn out accus, I’d be most grateful. I guess the constant plugging and unplugging of the accu and power cable isn’t the healthiest diet for this kind of hardware. Ow sacrifices … ;-)

Update: I’ve removed the percentage from the battery picture in the dialog, since it’s redundant (already displayed next to the “Battery:” label). Also, the dialog now reacts to font size changes on the fly.

Battery Improvements in KDE Plasma 4.4

The battery applet in KDE Plasma 4.4 has gotten some nice improvements. First of all, I wasn’t really happy with the layout of its popup dialog. It looked messy and didn’t scale well with bigger fonts. During Tokamak3 in September, I started improving this. To make it look calmer, I reduced the amount of edges widgets are aligned to. The previous version used nested layouts, which lead to widgets not properly aligned with each other. This creates a rather messy look. For 4.4, I’ve reworked the layout and reduced everything to only one layout and attached the battery in the popup off-layout in the top-right corner. I thought about using an AnchorLayout for this, but a simple setGeometry() to position the battery top-right would work as well, so I went for KISS. I also replaced the text on the "Configure Power Management" button with a tooltip, reducing visual clutter but keeping this handy in-context shortcut to easily get at the more advanced power managment settings.

The battery popup now resembles a FormLayout more closely, which should make it more consistent with how other dialogs in KDE are designed, so that’s a bonus in consistency. The two screenshots show the old and the new version of the applet side-by-side.

One wish came up more than once over the past months. Some (very vocal) users would like to see the battery showing the remaining time when it’s running on battery. Normally, the applet would show the charge percentage, which is a rather abstract number. (How long is 37%?) Now unfortunately, there’s no way to give an accurate estimation oft the time that’s left, since it largely depends on the usage patterns. You check the battery, it says "10 minutes left", then you start some app that exercises your CPU and disk and suddenly the machine goes into suspend after 3 minutes. Quite possible, and the usage scenarios and differences in modern portable hardware are such that there’s really no way to accurately predict the remaining battery lifetime. In the Plasma team, we decided that we rather not show the user unreliable information, since there’s only a very small group that understands that this number is almost black magic, and often simply wrongly reported by HAL. There’s well over 200 emails on that subject, mainly on the Plasma mailinglist and everytime this topic comes up we hear how much KDE must suck if this tiny little feature isn’t available. We’ve made this feature available in KDE 4.3, as a hidden config option (meaning that you cannot enable it using the configuration UI, but it’s there if you enable it in the configuration file. I had tentatively disabled this code during the larger part of the 4.4 development cycle to see if I’d get away with ditching it, and it didn’t quite fit in with the new layouting for the popup.
Lately, the same discussion came up again, hopefully for the last time, since I submitted a patch yesterday night that brings the remaining time back (still as hidden config option, and that’s about as far as we will go). No, there won’t be a checkbox since I don’t want to confront users with information that’s most likely bogus and highly depends on what you’re doing at this very moment. As the option needs a power user to understand what this info really means (i.e. an estimation that’s completely off or not, depending on what your BIOS or ACPI subsystem reports), I think we can reasonable expect that adding a line to a config file is easy enough for those who really, really, really want it.

So, for reference, here’s how you get the remaining time display in the battery applet.

  • Install KDE Plasma 4.4, at least trunk from today
  • kquitapp plasma-desktop (to stop your plasma shell, as long as it’s running, it can’t pick up config changes, if you stop it after you changed the config file, it will happily overwrite your hand-made changes on quit)
  • Open your plasma-desktop config file, (mine is ~/.kde4/share/config/plasma-desktop-appletsrc, YMMV)
  • Locate the section for the battery applet, in the below example, you’ll find the plugin=battery line, choose the section that adds [Configuration] to the identifier. This section might not exist if you’re using default settings, in that case, it’s easiest to check the “show charge information” checkbox in the battery’s config (you might need to restart plasma-desktop for that, don’t kill it afterwards but use kquitapp). Then locate the showBatteryString= line and add another line in the same section:
    showRemainingTime=true
  • Save the edited config file, restart plasma-desktop
[Containments][3][Applets][7][Configuration][Applets][30]
geometry=140,2.5,30,24
immutability=1
plugin=battery
zvalue=0

[Containments][3][Applets][7][Configuration][Applets][30][Configuration]
Share=false
showBatteryString=false
showRemainingTime=true

The remaining time will now be shown if it’s non-zero (obviously bogus since the machine would be off then) and the battery is discharging. If in doubt, use “plasmaengineexplorer –engine powermanagement” to check wether Solid reports the remaining time at all, and that it’s non-zero. The remaining time could also be shown while charging, but this apparently isn’t supported by my setup, so I can’t test it.

Also during Tokamak3, Dario fixed a bug that would switch the display’s brightness back to 100% after it was dimmed because the machine had been idle. So if you’d set it to 50%, and it would then dim after some minutes of idle time, you’d move the mouse and it pops back to 100%, while it should go back to 50%. That’s fixed as well, and the patch has also been backported to KDE 4.3. You probably are already running with this fix.

Update: I’ve just committed a couple of changes to the battery applet and explained them in a follow-up blog

I’m a *real* developer …

… not just a marketing guy. :-) During the Qt Developer Days in Munich, I took the Qt certification exam (actually as one of the first people to take it). It was my birthday, so they let me pass:

Nokia Certified Qt Developer
Also, right now I’m in Reykjavik, Iceland for the KDAB company meeting and 10 year anniversary. Preliminary conclusions: Watch out for roastbeef, it tastes like whale, riding on a horse feels like riding a square-wheeled bicycle (but slightly more scary) and having infinite amounts of energy under your rearside makes for interesting and relaxing uses and given a large-ish island with tectonic and seismic activity, you’ll find the capital at the most likely spot for an earthquake.

openSuse 11.2 rocks

Suse Linux 7.2 was the first Linux version I’ve installed myself and ran. Around 2001, I worked as webmaster at the Nijmegen School of Management, where I also studied back then. Fred Melssen, who was my colleague back then asked me to build a new webserver and sent me to the local bookstore to get a boxed version of Suse, which came, and still comes with a nicely printed manual. Fred told me to familiarize myself with the system so we could move parts of the infrastructure of the faculty’s quickly growing web infrastructure to Linux. Back then, I also started using Linux and KDE as my desktop, first using an X Server running on Windows 2000 and using the remote desktop from that machine. So SUSE Linux (or was it still called S.U.S.E?) was my first free OS.

I installed openSuse 11.2 on a new computer I picked up from a shop earlier. It’s a small form factor desktop, with a 1.6Ghz Atom CPU, an Intel 945 graphics chip, 2GB of RAM and a 160GB hard disk. Nothing fancy, but good enough for web browsing, emails, and “casual computing”. The installation went smooth, I could even install it from a USB stick, which is nice since it seems to be faster and produces less useless coasters. After booting, I’m really impressed and pleased with the Operating System. It simply doesn’t get in the way, everything is nicely integrated, even Firefox. It looks all very well polished, from technicalities like suspend/resume working out of the box, compositing effects enabled without having to do anything, and even sound just working (apparently pulseaudio has been removed from the installation) to visual aspects. I also very much like the looks, it looks very much like openSuse, but really slick. The theme it uses is based on Nuno Pinheiro’s Air which is the default for KDE 4.3. As part of a programme to streamline branding between up- and downstream (in this case KDE and openSuse, other distros are also involved), Nuno has been working with the openSuse guys to provide a branded theme for openSuse. The result is simply astonishing, and it the result of years of hard work from the Oxygen theme all across visual and aesthetic aspects of the OS (pun intended). It’s really nice to see icons, widget theme, window decoration, wallpapers, desktop widget theme and so on all matching so nicely, enhanced by subtle translucency effects and animations. It’s very beautiful and usable.

Congratulations to the openSuse community to a solid and beautiful release!