Hacking gnome-power-manager

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”

  1. […] “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. […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: