How to make ThinkPad volume keys work properly in Kubuntu

I really like Ubuntu. I mean, I really, really like it. But it exhibits one really irritating behaviour on most IBM/Lenovo ThinkPads. You see, ThinkPads (except for some in the R series) have a hardware sound mixer, and the volume control buttons operate the mixer directly in hardware, without any interaction from the operating system. This is unusual; most other laptops have software buttons which the OS must interpret and use to control the software mixer.

Now, on most distributions, I would just run tpb, and it gives a little on-screen display when I press one of the buttons. Ubuntu, however, is different. It has a special hotkeys subsystem which interprets the button presses on all sorts of laptops and passes them to a generic control program. Unfortunately, this system doesn’t know that the ThinkPad interprets the keys on its own; so every time you press a volume key, it gets interpreted in hardware and in software. This is really irritating, because the volume jumps in huge steps every time you press the button. And if you change the volume in software, they get out of sync and it all gets really complicated.

The appropriate behaviour, of course, would be to just display a notification without changing the software mixer’s volume; and I hope the Ubuntu folks will eventually implement this. For the meanwhile, anyway, there is a fix at least for Kubuntu. (Sorry, GNOME users, I don’t know what the equivalent solution is for you).

  1. Install the package kmilo-legacy.
  2. Arrange to have read access to the device /dev/nvram. On Feisty, at least, this required setting up a custom udev rule by creating a file /etc/udev/rules.d/50-user-custom.rules with contents KERNEL=="nvram", MODE="0664" and running chmod 0664 /dev/nvram to fix the permissions without rebooting.
  3. Run kcmshell thinkpad, and then tick the “Run Thinkpad Buttons KMilo Plugin” option and untick the “Change volume in software” option.
  4. Remove the file /usr/share/services/kmilo/kmilo_generic.desktop. (Or move it somewhere else, or rename it to something that doesn’t end in .desktop, or whatever else will stop KDE from seeing it.)
  5. Log out and log in again.
  6. Voila!

One useful side effect is that you will now get on-screen notifications when the other ThinkPad special buttons – like the brightness controls, the ThinkLight button, and so on – are pressed.

Tags: , ,

5 Responses to “How to make ThinkPad volume keys work properly in Kubuntu”

  1. conrad says:

    My word, I’ve always wondered about this.
    I had a Thinkpad for years and then I switched to a HP Pavilion, and I was quite disappointed about the software-based volume controls, since they are unresponsive when the computer is under load, and if I’m in a public place where I need to be quiet, I can’t mute before the startup sound plays when I switch on the laptop!

  2. Max says:

    I’ve been wondering about this myself. kmilo-legacy says you should file a bug if you need it; did you?

  3. adrian says:

    Max: no, I didn’t, because I don’t *need* it per se. I think that if I do the devs’ response will be “file a bug to add corresponding features to kmilo-hotkeys” (or whatever it’s called). But perhaps I should, and see what they say.

  4. steve says:

    hi..i did a reformat of my thinkpad t43p and deleted everything including all partions. I then reinstalled xp and all the drivers from the lenovo website. Everything is fine except I have lost the onscreen volume display showing up when i press the external volume controls. Any advice would be very appreciated. Thanks

  5. Manki says:

    Thanks a ton! :)

Leave a Reply