window-list: Handle changes to workspace menu

For now the menu is always set at construction time, however this
will change in the future. Prepare for that by handling the
`menu-set` signal, similar to the top bar.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/307>
This commit is contained in:
Florian Müllner
2024-03-21 16:49:35 +01:00
committed by Marge Bot
parent 8693a8a74c
commit 9c97f01bc2

View File

@@ -765,7 +765,9 @@ class WindowList extends St.Widget {
this._updateWorkspaceIndicatorVisibility();
this._menuManager = new PopupMenu.PopupMenuManager(this);
this._menuManager.addMenu(this._workspaceIndicator.menu);
this._workspaceIndicator.connectObject('menu-set',
() => this._onWorkspaceMenuSet(), this);
this._onWorkspaceMenuSet();
Main.layoutManager.addChrome(this, {
affectsStruts: true,
@@ -862,6 +864,11 @@ class WindowList extends St.Widget {
children[newActive].activate();
}
_onWorkspaceMenuSet() {
if (this._workspaceIndicator.menu)
this._menuManager.addMenu(this._workspaceIndicator.menu);
}
_updatePosition() {
this.set_position(
this._monitor.x,