From 25a75e1b0e51d472230c914f3cdcda31a1ff8b8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Tue, 7 Nov 2023 15:40:05 +0100 Subject: [PATCH] workspace-indicator: Only initialize preview visibility on map The check whether the window overlaps with the monitor the actor is on requires the actor to be added to the stage first, so delay the initial visibility update that was added in commit b9d2a445b2. Fixes: b9d2a445 ("workspace-indicator: Initialize preview visibility") Closes: https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/issues/469 Part-of: --- extensions/workspace-indicator/extension.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/extensions/workspace-indicator/extension.js b/extensions/workspace-indicator/extension.js index 0df9e038..ee84ed3f 100644 --- a/extensions/workspace-indicator/extension.js +++ b/extensions/workspace-indicator/extension.js @@ -49,7 +49,6 @@ class WindowPreview extends St.Button { }, 'notify::minimized', this._updateVisible.bind(this), this); - this._updateVisible(); global.display.connectObject('notify::focus-window', this._onFocusChanged.bind(this), this); @@ -61,6 +60,12 @@ class WindowPreview extends St.Button { return this._window; } + vfunc_map() { + super.vfunc_map(); + // initialize visibility after being added to the stage + setTimeout(() => this._updateVisible()); + } + _onFocusChanged() { if (global.display.focus_window === this._window) this.add_style_class_name('active');