I have shortcut/Fn keys to Suspend, Hibernate, Lock the screen, Increase/Reduce Brightness etc… in my laptop. When power goes off, first thing I usually do is try to turn the display off to save power. Well – there’s no keyboard shortcut for putting the display to sleep or turn it off. I have to either run xset dpms force off
or create a custom shortcut key and assign this command to it.
Instead, I’ve been thinking about adding a button to the gnome-power-manager. When I click on that, essentially my display will turn off. Further, I figured out I’ll have to use DPMSForceLevel (3)
from manpages. There are already two icons, for Suspend and Hibernate, and I thought their implementation details might help.
So this morning, when I woke up, I directly went to the computer, downloaded the gnome-power-manager tar ball and started to look at the code. I must appreciate the fact that how clean the code is, and it was a breeze to extend the existing functionality. Surprisingly, the DPMS functions were already implemented. I just had to add a MenuItem to the Tray Icon, add the callback functions in place, and call “gpm_manager_blank_screen”.
And here is the outcome:
5 responses to “Hacking gnome-power-manager”
A gnome applet to do this would be a nice thing to have as well 🙂
Can you pass on the diff.gz file and the version number of the NetworkManager source tarball you downloaded?
Sorry, I meant “gnome-power-manager “. Sorry for the typo
[…] “Put display to sleep when inactive for” shows a minimum of 11 minutes. Sometimes when I go to sleep and set a torrent on download, I would like to screen to go off immediately, say 2 mins. The minimum time should not be so high. I know a simple workaround would be to hack the source code and re-compile. Here is an example of the geekery. […]
Okay, Manish. 🙂
Since you insist, here’s the patch against g-p-m 2.26 [ http://www.nabble.com/-RFC—PATCH–Turn-Display-Off-tray-icon-and-functionality-to23019879.html ]. I have sent this to upstream, not sure if it will be accepted or not.
I had a patch for g-p-m 2.24 also lying around somewhere in my machine, I can sent it to you if you need.