Thinkpad Hotkeys in KDE4

I have kept my Thinkpad X61 laptop up to date with Debian sid for a few years. The KDE4 in Debian sid is at version 4.4.5 at this moment, and I think it is mature enough for me to switch the laptop power management from my own hacked up solution to a KDE integrated one. My old solution still works for the most part, but there are some glitches after repeated supsend-resume cycles. As the system keeps evolving, I suspect more things would break.

Power management in KDE4 is handled by PowerDevil, which is disabled if powersaved is running (my old solution relied on powersaved). First I uninstalled powersaved and reboot, sure enough, all Fn hotkeys stops working. Now I go to KDE System Settings -> Advanced -> Power Management, and see the PowerDevil seems to be in a health state. The problem is that the hotkey presses are intercepted by ACPI so KDE does not receive these events. To stop the interruption, I edit /etc/modules as root and comment out thinkpad_acpi module, reboot. Now the Fn hotkeys should be registered in KDE, all we need to do is to make them do things we want. 

To set up global hotkeys, we go to System Settings -> Input Actions, I add a new group called My Shortcuts and enabled it. Right-click My Shortcuts, New->Global Shortcut->DBus Command, I create a new entry Hibernate, and in the Action tab fill in needed dbus information for hibernating the system with PowerDevil (See screenshot). Basically, this is similar to issuing a console command "qdbus org.kde.powerdevil /modules/powerdevil suspend 4". Here, the parameter 4 is for hibernate (suspend to disk), 2 is for sleep (suspend to memory), and 1 for lock screen.  In the Trigger tab, click the button, and press Fn+F12, notice that KDE recognizes this key as a Suspend key. Now click Apply, the Fn+F12 hotkey is setup. Now try Fn+F12, the system should hibernate. So far, the hibernate-resume cycles seem to be clean and problem free for me. I am using 2.6.36 kernel. 

Overall, this seems to be easy enough. No scripts, no hacks.

hibernate-snapshot2

Comments

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account associated with the e-mail address you provide, it will be used to display your avatar.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <div> <h1><h2><h3><sub><sup><b><i><u><font><img>
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Lines and paragraphs break automatically.

More information about formatting options

To prevent automated spam submissions leave this field empty.
Nice place