Sleep Button in KDE 4 Workaround

If you noticed that pushing the sleep button does nothing in KDE 4 (as of this writing <=4.3.3), this is because of a bug in KDEs’ power management tool Powerdevil. It appears that in most cases Powerdevil does not recognize the Xorg servers’ XF86Sleep key. To fix this, you may be able to rebind the sleep key in the KDE control panel.

Add a New Input Action

Open System Settings then Input Actions. Then add a new Global Shortcut:

Name it ‘Sleep’ or whatever you like. Add a Comment if you wish and in the Trigger tab select your hotkey. Try setting the sleep key first. For me, setting the hotkey to the sleep key didn’t work because I believe that Powerdevil already has it bound. There have been others though that look to have sucessfully done so.

Note: If someone knows of a way to decouple the Powerdevil sleep key please let me know.

I bound mine to Scroll Lock (hope I don’t need it anytime soon) then in the Action tab entere the dbus command to suspend to ram:

qdbus org.kde.kded /modules/powerdevil suspend 2

If this doesn’t work, try ‘suspend 1′. If you would like to suspend to disk:

Still as relevant as in 2009… guess not a lot of people get ‘suspend to ram/disk’ working on their machine. (Or just a few people have a ‘Sleep’ button, which could also be because Linux people rarely ever have a Microsoft keyboard ;-) )

in opensuse 11.4 this workaround is no longer working. I did it in 11.3 but in 11.4 qdbus says it cannot find .suspend in /modules/powerdevil at org.kde.kded I also tried org.kde.Solid.PowerManagement to no avail.

Welcome to linuxtidbits.

linuxtidbits is a place for common bits of Linux knowledge. Linux is a good operating system with good people. Being part of Linux, to me, means being a part of something that everyone can contribute to.