Enabling the suspend hotkey in KDE4

There are several reports of problems with the suspend hotkey on KDE4 [1] [2]. And there is even a bug report on that issue. Naturally, I wouldn’t write about this if I hadn’t experienced the same problem myself. I solved it by slightly modifiying the approach described at Linux Basement, avoiding the need to create a dedicated shell script somewhere.

This might not have been possible in KDE 4.2 (I haven’t verified), but it is in KDE SC 4.4. The Input Actions dialog (under System Settings) allows for the configuration of DBus calls from hotkeys. This was configured fast and works painless. I have exported the hotkey group and pasted the content below. To use it, save this as PowerManagement.khotkeys and import it in the Input Actions dialog.

[Data]
DataCount=1

[Data_1]
Comment=Power management mappings of XF86 events
DataCount=1
Enabled=true
Name=Power Management
SystemGroup=0
Type=ACTION_DATA_GROUP

[Data_1Conditions]
Comment=
ConditionsCount=0

[Data_1_1]
Comment=Enables suspend hotkey
Enabled=true
Name=Suspend
Type=SIMPLE_ACTION_DATA

[Data_1_1Actions]
ActionsCount=1

[Data_1_1Actions0]
Arguments=
Call=org.freedesktop.PowerManagement.Suspend
RemoteApp=org.freedesktop.PowerManagement
RemoteObj=/org/freedesktop/PowerManagement
Type=DBUS

[Data_1_1Conditions]
Comment=
ConditionsCount=0

[Data_1_1Triggers]
Comment=Simple_action
TriggersCount=1

[Data_1_1Triggers0]
Key=Sleep
Type=SHORTCUT
Uuid={c1706a53-bde8-4364-b0af-71e9c1be6b3f}

[Main]
AllowMerge=true
ImportId=Power Management
Version=2