GNOME Shell v.32 breaks extensions API with legacy GJS Lang module
System information
Ubuntu 19.04, Arch Linux GNOME Shell 3.32
Bug information
Steps to reproduce
- Install some extension which using inheriting of "pure" JS GNOME Shell classes like popupMenu.PopupBaseMenuItem to an example.
- You will get an JS exception.
Current behaviour
Messages in the system journal (sudo journalctl
):
mars 16 09:24:02 user gnome-shell[7372]: Extension "uuid@extension" had error: TypeError: this._construct is not a function
Possible solution
I have noticed that inheriting from GNOME Shell classes based on St.Widgets which are based on GObject don't break extension's API and work well. See panelMenu.ButtonBox
etc
So you should inherit all GNOME Shell classes from GObject or GObject based classes and will work fine. For an example for the popupMenu.PopupBaseMenuItem class it should be something like this:
var PopupBaseMenuItem = GObject.registerClass({
Signals: {
'activate': {},
'sensitive-changed': {},
'active-changed': {param_types: [GObject.TYPE_BOOLEAN]}
},
}, class PopupBaseMenuItem extends GObject {
_init(params) {
super._init({});
params = Params.parse (params, { reactive: true,
activate: true,
hover: true,
style_class: null,
can_focus: true
});
this.actor = new St.BoxLayout({ style_class: 'popup-menu-item',
reactive: params.reactive,
track_hover: params.reactive,
can_focus: params.can_focus,
accessible_role: Atk.Role.MENU_ITEM });
this.actor._delegate = this;
...
}
...
}
Or even inherit it from already GObject St.BoxLayout
class
It would be really helpful to support extensions for different Shell versions.
Thanks!