From 9c8c3495b6fd37e79a5051cd492b7260de4bc2be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Wed, 21 Feb 2024 16:14:24 +0100 Subject: [PATCH] workspace-indicator: Don't use menu section We never added anything else to the menu, so we can just operate on the entire menu instead of an intermediate section. This removes another difference with the window-list copy. Part-of: --- extensions/workspace-indicator/workspaceIndicator.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/extensions/workspace-indicator/workspaceIndicator.js b/extensions/workspace-indicator/workspaceIndicator.js index 26c9d7ee..117c7a65 100644 --- a/extensions/workspace-indicator/workspaceIndicator.js +++ b/extensions/workspace-indicator/workspaceIndicator.js @@ -292,8 +292,6 @@ export class WorkspaceIndicator extends PanelMenu.Button { container.add_child(this._thumbnailsBox); this._workspacesItems = []; - this._workspaceSection = new PopupMenu.PopupMenuSection(); - this.menu.addMenuItem(this._workspaceSection); workspaceManager.connectObject( 'notify::n-workspaces', this._nWorkspacesChanged.bind(this), GObject.ConnectFlags.AFTER, @@ -303,7 +301,7 @@ export class WorkspaceIndicator extends PanelMenu.Button { this.connect('scroll-event', this._onScrollEvent.bind(this)); this._thumbnailsBox.connect('scroll-event', this._onScrollEvent.bind(this)); - this._createWorkspacesSection(); + this._updateMenu(); this._updateThumbnails(); this._updateThumbnailVisibility(); @@ -346,7 +344,7 @@ export class WorkspaceIndicator extends PanelMenu.Button { } _nWorkspacesChanged() { - this._createWorkspacesSection(); + this._updateMenu(); this._updateThumbnails(); this._updateThumbnailVisibility(); } @@ -382,17 +380,17 @@ export class WorkspaceIndicator extends PanelMenu.Button { this._workspacesItems[i].label.text = this._labelText(i); } - _createWorkspacesSection() { + _updateMenu() { let workspaceManager = global.workspace_manager; - this._workspaceSection.removeAll(); + this.menu.removeAll(); this._workspacesItems = []; this._currentWorkspace = workspaceManager.get_active_workspace_index(); let i = 0; for (; i < workspaceManager.n_workspaces; i++) { this._workspacesItems[i] = new PopupMenu.PopupMenuItem(this._labelText(i)); - this._workspaceSection.addMenuItem(this._workspacesItems[i]); + this.menu.addMenuItem(this._workspacesItems[i]); this._workspacesItems[i].workspaceId = i; this._workspacesItems[i].label_actor = this._statusLabel; this._workspacesItems[i].connect('activate', (actor, _event) => {