mmod / mmod-panel

MMOD Panel is an upgrade to the Topbar in Gnome3, creating a customizable panel and providing options for fine-tuning your Desktop Experience.
Other
12 stars 8 forks source link

unchecking "Show running" causes extension to crash #16

Closed Remington012 closed 9 years ago

Remington012 commented 9 years ago

I installed the MMOD panel extension, customized it a little bit, and was using it for a while. A little later, I noticed that new windows that I opened appeared as additional "favorites" in the panel, which I didn't like. I went back into the MMOD panel settings, and noticed that the "Show running" checkbox in the "Display favorites" section was checked. When I unchecked it, all my favorites disappeared from the panel, and as far as I can tell, the MMOD panel extension completely stopped running.

I tried re-checking/unchecking the boxes in the MMOD panel settings, and I tried logging out and back in again -- nothing worked. I tried uninstalling and reinstalling the MMOD panel extension, to no avail.
The tweak tool (advanced settings) menu will not let me enable MMOD panel anymore (it shows a little triangle/error logo), and the Gnome extensions website ( https://extensions.gnome.org/extension/898/mmod-panel/ ) explicitly shows a red "ERROR" box, in place of the on/off switch at the top left.

The only clue I can find is this error message in /var/log/messages:

gnome-session[1598]: Gjs-Message: JS LOG: Extension "mmod-panel@mmogp.com" had error: TypeError: main.panel.statusArea.aggregateMenu.menu._getMenuItems(...)[9].addMenuItem is not a function

Please let me know if there are other logs or debugging information which would help.

kirvedx commented 9 years ago

Could you please tell me your OS and Gnome Shell version?

Remington012 commented 9 years ago

Debian 8.0 (stable/jessie), Gnome 3.14.1

kirvedx commented 9 years ago

On Fri, 2015-05-08 at 13:34 -0700, Remington012 wrote:

Debian 8.0 (stable/jessie), Gnome 3.14.1

That is odd, this is what I use, and what MMOD Panel was originally developed on.

Could you click the Aggregate Menu and provide me a screen-shot of its pop-[down/up ] menu? I can provide instruction for choosing the right index (will require manual file modification) as well if you are comfortable digging in the code.

Please advise,

Rik

Remington012 commented 9 years ago

I'm assuming that "Aggregate Menu" means the drop-down menu with sound/settings/lock/power, i.e. "menu in tray menu". The MMOD-panel sub-menu there no longer appears for me.
screenshot1 Sure, I can tweak the code if necessary, though it seems like I first need to figure out how to convince gnome-shell that the MMOD-panel extension is "on". The "favorites" do sometimes appear in the panel (they sometimes start showing up again after screen lock/unlock), so it seems MMOD-panel is actually running.

kirvedx commented 9 years ago

On Fri, 2015-05-08 at 14:58 -0700, Remington012 wrote:

I'm assuming that "Aggregate Menu" means the drop-down menu with sound/settings/lock/power, i.e. "menu in tray menu". The MMOD-panel sub-menu there no longer appears for me.

Could you try disabling the Applications menu?

Yeah, your Aggregate Menu has far less items than mine does, so I think I need to run a loop in the logic to check the normal outer limit for where we want the menu option to go in the aggregate menu, and properly check backwards until we find the right place (which would fix your issue in the aggreagte menu, and as is normal for js, probably the rest of the issues present as a result of that too)

If disabling the Applications menu (left of top bar, setting is in tweak tool) does not resolve the issue, I'll go ahead and work out the logic I've spoken of above and can provide you instruction to copy/paste it into the right file so you can have said fix (and test it) prior to the next MMod Panel release.

Please advise,

Rik

Remington012 commented 9 years ago

Turning off the Applications Menu extension didn't change anything.

Let me know if/whenever you have some code changes you'd like me to test out.

Remington012 commented 9 years ago

Hmmm.... I tried removing extension and reinstalling it again. To "fully" remove it (i.e. to remove the ~/.local/share/gnome-shell/extensions/mmod-panel@mmogp.com/ directory), I had to log out of gnome and manually delete the directory from console, since there was some NFS lockfile in the schemas subdirectory.

When I logged back in and tried reinstalling MMOD panel, it immediately failed to load, with the same message as before in the /var/log/messages:

gnome-session[1255]: Gjs-Message: JS LOG: Extension "mmod-panel@mmogp.com" had error: TypeError: main.panel.statusArea.aggregateMenu.menu._getMenuItems(...)[9].addMenuItem is not a function

Then I turned off the "Applications menu" and "SettingsCenter" extensions, and repeated the process (remove MMOD panel, log out, finish removing the "mmod-panel@mmogp.com" directory, log back in). This time when I installed MMOD panel again, it actually loaded. I also re-enabled my other extensions, and MMOD panel is still working (so far), but I dare not play around much with any customizations. One of my coworkers has a very similar Debian setup, and he also had MMOD panel crash soon after trying to customize it (though without touching the "Show running" checkbox like me).

kirvedx commented 9 years ago

On Wed, 2015-05-20 at 17:54 -0700, Remington012 wrote:

Hmmm.... I tried removing extension and reinstalling it again. To "fully" remove it (i.e. to remove the ~/.local/share/gnome-shell/extensions/mmod-panel@mmogp.com/ directory), I had to log out of gnome and manually delete the directory from console, since there was some NFS lockfile in the schemas subdirectory.

When I logged back in and tried reinstalling MMOD panel, it immediately failed to load, with the same message as before in the /var/log/messages:

gnome-session[1255]: Gjs-Message: JS LOG: Extension "mmod-panel@mmogp.com" had error: TypeError: main.panel.statusArea.aggregateMenu.menu._getMenuItems(...)[9].addMenuItem is not a function

Then I turned off the "Applications menu" and "SettingsCenter" extensions, and repeated the process (remove MMOD panel, log out, finish removing the "mmod-panel@mmogp.com" directory, log back in). This time when I installed MMOD panel again, it actually loaded. I also re-enabled my other extensions, and MMOD panel is still working (so far), but I dare not play around much with any customizations. One of my coworkers has a very similar Debian setup, and he also had MMOD panel crash soon after trying to customize it (though without touching the "Show running" checkbox like me).

— Reply to this email directly or view it on GitHub.

I have pondered on the issue and reviewed code, and have realized where I went wrong. The fix is rather simple but I'll have to get a write-up together for you with the details as atm I'm away from my development machine.

The write-up would just explain where files are and what line(s) to modify, it'd be in 1 file and would fix the issue with the aggregate menu.

I'll have it uploaded to extensions.gnome.org before long but until then you could attempt the manual fix (once I forward it to you).

The issue with 'show applications menu' in the Tweak Tool - and MMOD-Panel possibly having issues displaying icons on the left side of the panel as a result of that option being enabled - is one I'll have to apply logic for checking whether that option/menu is enabled or not and handling the case accordingly. That one might be a little longer.

Sorry for the delay with this, have been rather busy lately and do appreciate the feedback :)

Best,

Rik

kirvedx commented 9 years ago

Terribly sorry for the delay, to manually patch the code until the release is available please perform the following:

  1. Edit: ~/.local/share/gnome-shell/extensions/mmod-panel@mmogp.com/lib/mmod/aggregate.js

    Select lines 88-100 and replace with the following:

    for( let i = 9; i >= 0; i-- )
    {
       if( main.panel.statusArea.aggregateMenu.menu._getMenuItems()[i] )
       {
           if( typeof( main.panel.statusArea.aggregateMenu.menu._getMenuItems()[i].addMenuItem ) === typeof( function_model ) )
           {
               main.panel.statusArea.aggregateMenu.menu._getMenuItems()[i].addMenuItem( new pum.PopupSeparatorMenuItem(), 1 );
               main.panel.statusArea.aggregateMenu.menu._getMenuItems()[i].addMenuItem( this.popup, 2 );
               i = -1;
           }
           else
           {
               log( '[MMOD Panel]: Could not find a point of entry to the Aggregate Menu.' );
           }
       }
    }
  2. Now restart your gnome-shell by either: A. Restarting your device. B. Pressing ALT+F2, and then typing r, and finally, pressing Enter or Return on your keyboard.

If the fix will work it should be reflecting so at this time.

kirvedx commented 9 years ago

Please refer to the new repository location for further communication via this matter:

https://code.mmogp.com/mmod/mmod-panel/issues/4

Best,

Rik

Remington012 commented 9 years ago

Thanks -- the recent update seems to be working.