The status menu, which is the dropdown menu to the right most corner on the top panel in gnome 3 contains the Suspend option. This is an alternating option, if you focus on the Suspend option and hit the "Alt" key, you will also see the "Power Off" option.
But I wanted the "Power Off" option to be shown in all cases along with the Suspend option. Here is how I dissected the issue (for the facts, this is the first time I am even looking at gnome 3 code).
1) Located the gnome-shell repository at http://git.gnome.org/browse/gnome-shell/tree/, searched for "Suspend" , and landed at the commit, http://git.gnome.org/browse/gnome-shell/commit/?id=610c2b59872029bceb0279b24dc9637a85f54968.
2) Going through the above commit, figured out that the corresponding UI stuff is in http://git.gnome.org/browse/gnome-shell/tree/js/ui/statusMenu.js
3) Cloned the gnome-shell repository. Edited the file gnome-shell/src/js/ui/statusMenu.js and made the following changes :
--> Made the Suspend option a non-alternating Menu item and display it only if we have suspend support.
--> Added the Power Off option as a new menu item and added a function which would be called when the option is activated.
Voila , I now have the Power Off option as a separate option. Here are the before and after screenshots.
But I wanted the "Power Off" option to be shown in all cases along with the Suspend option. Here is how I dissected the issue (for the facts, this is the first time I am even looking at gnome 3 code).
1) Located the gnome-shell repository at http://git.gnome.org/browse/gnome-shell/tree/, searched for "Suspend" , and landed at the commit, http://git.gnome.org/browse/gnome-shell/commit/?id=610c2b59872029bceb0279b24dc9637a85f54968.
2) Going through the above commit, figured out that the corresponding UI stuff is in http://git.gnome.org/browse/gnome-shell/tree/js/ui/statusMenu.js
3) Cloned the gnome-shell repository. Edited the file gnome-shell/src/js/ui/statusMenu.js and made the following changes :
--> Made the Suspend option a non-alternating Menu item and display it only if we have suspend support.
--> Added the Power Off option as a new menu item and added a function which would be called when the option is activated.
Voila , I now have the Power Off option as a separate option. Here are the before and after screenshots.
The patch to the latest trunk of the gnome-shell repository which does this is here.
For compiling the gnome-shell code once you have made the changes, follow the usual, "configure", "make" steps and then run "gnome-shell/src/gnome-shell --replace" to use the newly compiled gnome-shell instead of your existing gnome-shell.
This post is more aimed at providing a general flow for fixing issues, not really much in here.
No comments:
Post a Comment