From cc2af75fb42d1b920d77a2bd577afffe2e015ad0 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Fri, 23 Jul 2021 17:33:43 +0800 Subject: [PATCH] workspace: Remove skip-taskbar windows while the overview is shown On startup desktop-icons-ng Wayland windows have skip-taskbar==FALSE so initially pass `_isOverviewWindow` and they get added to the overview, which is confusing to users. However almost immediately after that they get `meta_wayland_client_hide_from_window_list` and are removed from future overviews. So now we respond to `notify::skip-taskbar` immediately and prevent desktop-icons-ng appearing in the startup overview too. This is messy and ideally we'd like to know the window type immediately on creation, but that option only exists in X11 and not Wayland. https://gitlab.com/rastersoft/desktop-icons-ng/-/issues/137 https://bugs.launchpad.net/bugs/1936643 Part-of: --- js/ui/workspace.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/js/ui/workspace.js b/js/ui/workspace.js index 7e6018fbd..7bc3cdfb6 100644 --- a/js/ui/workspace.js +++ b/js/ui/workspace.js @@ -1106,6 +1106,7 @@ class Workspace extends St.Widget { this.connect('style-changed', this._onStyleChanged.bind(this)); this.connect('destroy', this._onDestroy.bind(this)); + this._skipTaskbarSignals = new Map(); const windows = global.get_window_actors().map(a => a.meta_window) .filter(this._isMyWindow, this); @@ -1232,6 +1233,14 @@ class Workspace extends St.Widget { if (!this._isMyWindow(metaWin)) return; + this._skipTaskbarSignals.set(metaWin, + metaWin.connect('notify::skip-taskbar', () => { + if (metaWin.skip_taskbar) + this._doRemoveWindow(metaWin); + else + this._doAddWindow(metaWin); + })); + if (!this._isOverviewWindow(metaWin)) { if (metaWin.get_transient_for() == null) return; @@ -1300,7 +1309,15 @@ class Workspace extends St.Widget { return false; } + _clearSkipTaskbarSignals() { + for (const [metaWin, id] of this._skipTaskbarSignals) + metaWin.disconnect(id); + this._skipTaskbarSignals.clear(); + } + prepareToLeaveOverview() { + this._clearSkipTaskbarSignals(); + for (let i = 0; i < this._windows.length; i++) this._windows[i].remove_all_transitions(); @@ -1314,6 +1331,8 @@ class Workspace extends St.Widget { } _onDestroy() { + this._clearSkipTaskbarSignals(); + if (this._overviewHiddenId) { Main.overview.disconnect(this._overviewHiddenId); this._overviewHiddenId = 0;