From a929cf9370b935084b5271a9937bd7b972b9e7fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Fri, 1 Dec 2023 19:13:42 +0100 Subject: [PATCH] workspace-indicator: Don't hide previews on other monitors Workspace thumbnails are clipped, so there's no major benefit of hiding the actors explicitly. On the other hand, the check is useful on size/position changes to avoid unnecessary relayouts. Part-of: (cherry picked from commit b5b841dd38b9d7e62e9162eee56f7edebca32aa5) --- extensions/workspace-indicator/extension.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/extensions/workspace-indicator/extension.js b/extensions/workspace-indicator/extension.js index 0df9e038..28dca0ff 100644 --- a/extensions/workspace-indicator/extension.js +++ b/extensions/workspace-indicator/extension.js @@ -42,11 +42,8 @@ class WindowPreview extends St.Button { this._window = window; this._window.connectObject( - 'size-changed', () => this.queue_relayout(), - 'position-changed', () => { - this._updateVisible(); - this.queue_relayout(); - }, + 'size-changed', () => this._checkRelayout(), + 'position-changed', () => this._checkRelayout(), 'notify::minimized', this._updateVisible.bind(this), this); this._updateVisible(); @@ -68,11 +65,15 @@ class WindowPreview extends St.Button { this.remove_style_class_name('active'); } - _updateVisible() { + _checkRelayout() { const monitor = Main.layoutManager.findIndexForActor(this); const workArea = Main.layoutManager.getWorkAreaForMonitor(monitor); - this.visible = this._window.get_frame_rect().overlap(workArea) && - this._window.window_type !== Meta.WindowType.DESKTOP && + if (this._window.get_frame_rect().overlap(workArea)) + this.queue_relayout(); + } + + _updateVisible() { + this.visible = this._window.window_type !== Meta.WindowType.DESKTOP && this._window.showing_on_its_workspace(); } }