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: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1925>
This commit is contained in:
Daniel van Vugt 2021-07-23 17:33:43 +08:00 committed by Marge Bot
parent a8f1722a9f
commit cc2af75fb4

View File

@ -1106,6 +1106,7 @@ class Workspace extends St.Widget {
this.connect('style-changed', this._onStyleChanged.bind(this)); this.connect('style-changed', this._onStyleChanged.bind(this));
this.connect('destroy', this._onDestroy.bind(this)); this.connect('destroy', this._onDestroy.bind(this));
this._skipTaskbarSignals = new Map();
const windows = global.get_window_actors().map(a => a.meta_window) const windows = global.get_window_actors().map(a => a.meta_window)
.filter(this._isMyWindow, this); .filter(this._isMyWindow, this);
@ -1232,6 +1233,14 @@ class Workspace extends St.Widget {
if (!this._isMyWindow(metaWin)) if (!this._isMyWindow(metaWin))
return; 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 (!this._isOverviewWindow(metaWin)) {
if (metaWin.get_transient_for() == null) if (metaWin.get_transient_for() == null)
return; return;
@ -1300,7 +1309,15 @@ class Workspace extends St.Widget {
return false; return false;
} }
_clearSkipTaskbarSignals() {
for (const [metaWin, id] of this._skipTaskbarSignals)
metaWin.disconnect(id);
this._skipTaskbarSignals.clear();
}
prepareToLeaveOverview() { prepareToLeaveOverview() {
this._clearSkipTaskbarSignals();
for (let i = 0; i < this._windows.length; i++) for (let i = 0; i < this._windows.length; i++)
this._windows[i].remove_all_transitions(); this._windows[i].remove_all_transitions();
@ -1314,6 +1331,8 @@ class Workspace extends St.Widget {
} }
_onDestroy() { _onDestroy() {
this._clearSkipTaskbarSignals();
if (this._overviewHiddenId) { if (this._overviewHiddenId) {
Main.overview.disconnect(this._overviewHiddenId); Main.overview.disconnect(this._overviewHiddenId);
this._overviewHiddenId = 0; this._overviewHiddenId = 0;