1

I'm curently working on some extension to the gnome-shell. I added a new Popup menu into aggregate menu in status area, but can't move it to the desired position. Tried menu.moveMenuItem(item, position), but it moves only the "main" item, not the entire dropdown (How it looks - my PopupSubMenuMenuItem is named ThermalManagement, and submenu menu items starts from Optimized). What I need to do to move an entire submenu into specific position?

Code sample:

enable() {
    this._item = new PopupMenu.PopupSubMenuMenuItem('Thermal Management', true);
    this._item.icon.icon_name = 'applications-system-symbolic';
    let position = this._findMenuItemPosition(Main.panel.statusArea.aggregateMenu._power.menu) + 1;

    this._optimizedOption = this._createOptimizedOption();
    this._item.menu.addMenuItem(this._optimizedOption);

    this._quietOption = this._createQuietOption();
    this._item.menu.addMenuItem(this._quietOption);

    this._coolOption = this._createCoolOption();
    this._item.menu.addMenuItem(this._coolOption);

    this._ultraPerformanceOption = this._createUltraPerformanceOption();
    this._item.menu.addMenuItem(this._ultraPerformanceOption);

    Main.panel.statusArea.aggregateMenu.menu.addMenuItem(this._item);
    Main.panel.statusArea.aggregateMenu.menu.moveMenuItem(this._item, position);
}

0 Answers0