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.

gnome-power-manager-1

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:

gnome-power-manager-2

Advertisements

5 thoughts on “Hacking gnome-power-manager

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 )

Google+ photo

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

Connecting to %s