From e37516c8de7f18d5282977bff2752f8ca2cc1873 Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Sun, 23 Mar 2025 20:36:21 -0400 Subject: [PATCH] Fix activities method when no workspacedots gh-2289 --- src/panelManager.js | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/src/panelManager.js b/src/panelManager.js index 9d8c3e2..30fef89 100755 --- a/src/panelManager.js +++ b/src/panelManager.js @@ -170,19 +170,23 @@ export const PanelManager = class { }, ) - this._injectionManager.overrideMethod( - Object.getPrototypeOf( - // WorkspaceDot in activities button - Main.panel.statusArea.activities.get_first_child().get_first_child(), - ), - 'vfunc_get_preferred_width', - (get_preferred_width) => - function (forHeight) { - return Utils.getBoxLayoutVertical(this.get_parent()) - ? [0, forHeight] - : get_preferred_width.call(this, forHeight) - }, - ) + let activitiesChild = Main.panel.statusArea.activities.get_first_child() + + if (activitiesChild?.constructor.name == 'WorkspaceIndicators') { + this._injectionManager.overrideMethod( + Object.getPrototypeOf( + // WorkspaceDot in activities button + activitiesChild.get_first_child(), + ), + 'vfunc_get_preferred_width', + (get_preferred_width) => + function (forHeight) { + return Utils.getBoxLayoutVertical(this.get_parent()) + ? [0, forHeight] + : get_preferred_width.call(this, forHeight) + }, + ) + } LookingGlass.LookingGlass.prototype._oldResize = LookingGlass.LookingGlass.prototype._resize