Adds a shortcut to open Power Statistics from the battery indicator. Incredibly useful for laptop users. Now compatible with the system-monitor extension http://tinyurl.com/sysmon Depends on: gnome-power-statistics todo:rework placement
Note: Binary files aren't shown on the web site. To see all files, please download the extension zipfile.
Fine in general, but addMenuItem(, 3) is wrong if you have more than one battery (for example, you have a device charging via USB)
gcampax: do you mean using that placement method is incorrect because with more than one battery it would be placed somewhere else on the menu? as i see it, and i have only tested about ten times so i could be wrong, but '3' defines where it is to be placed?
I take it I can't just do something like battery.addMenuItem(item, -1); to add it to the end of the menu regardless?
Yes, 3 is the position, so yes, the problem is that with more than one battery the item could be before the separator or worse, right in the middle of the battery list. Not good. Unfortunately addMenuItem(, -1) doesn't work (file a core shell bug for that if you want), but you can do: let nItems = menu.numMenuItems; menu.addMenuItem(item, nItems - 2); (-2 because you want to be before the power settings item, right?)
OK, when using this method with - 2 it seems to add it before the separator . SO, I changed it to - 1 and it adds it after the separator. Will this break as well if there are 2 or more batteries, or is this the equivalent of "addMenuItem(, -1)" For now I will submit the changes.
I found another example of this method in the musicintegration extension and because that extension conflicts with the pulse audio shortcuts I did I thought it is worth mentioning that while musicintegration uses something like menu.menu.numMenuItems - 3 or - 1 I was trying to use the same for instance pulseMenu.menu.addSettingsAction(_("PulseAudio Volume Meter"), 'pavumeter.desktop', pulseMenu.menu.numMenuItems - 3) this seems to conflict somehow still with anything else adding something to the menu using this method perhaps, I can't figure out the problem, but I thought it is worth mentioning that perhaps something is wrong with this method as well? Must every instance of menu.menu.numMenuItems - 3 have a different position?? for example menu.menu.numMenuItems - 3 menu.menu.numMenuItems - 2 menu.menu.numMenuItems - 1 ?
Obsoleting, newer version