From 9876ae1b1916f713db78bf41f00ad3124cf23907 Mon Sep 17 00:00:00 2001 From: S1m Date: Wed, 24 Jan 2024 21:03:13 +0100 Subject: [PATCH 1/3] Rename nonPersistent to withWmId to make it easier to read --- lib/extension/window.js | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/lib/extension/window.js b/lib/extension/window.js index 762b920..7dadde6 100644 --- a/lib/extension/window.js +++ b/lib/extension/window.js @@ -77,9 +77,8 @@ export class WindowManager extends GObject.Object { Logger.info("forge initialized"); } - addFloatOverride(metaWindow, nonPersistent) { + addFloatOverride(metaWindow, withWmId) { let overrides = this.windowProps.overrides; - let wmTitle = metaWindow.get_title(); let wmClass = metaWindow.get_wm_class(); let wmId = metaWindow.get_id(); @@ -89,26 +88,24 @@ export class WindowManager extends GObject.Object { } overrides.push({ wmClass: wmClass, - wmId: nonPersistent ? wmId : undefined, + wmId: withWmId ? wmId : undefined, mode: "float", }); this.windowProps.overrides = overrides; this.ext.configMgr.windowProps = this.windowProps; } - removeFloatOverride(metaWindow, nonPersistent) { + removeFloatOverride(metaWindow, withWmId) { let overrides = this.windowProps.overrides; - let wmTitle = metaWindow.get_title(); let wmClass = metaWindow.get_wm_class(); let wmId = metaWindow.get_id(); - overrides = overrides.filter( (override) => !( override.wmClass === wmClass && + // rules with a Title are written by the user and peristent !override.wmTitle && - // persistent or tagged as tmp - (!nonPersistent || override.wmId === wmId) + (!withWmId || override.wmId === wmId) ) ); @@ -121,18 +118,18 @@ export class WindowManager extends GObject.Object { if (!nodeWindow || !(action || action.mode)) return; if (nodeWindow.nodeType !== NODE_TYPES.WINDOW) return; - let nonPersistent = action.name === "FloatToggle"; + let withWmId = action.name === "FloatToggle"; let floatingExempt = this.isFloatingExempt(metaWindow); if (floatingExempt) { - this.removeFloatOverride(metaWindow, nonPersistent); + this.removeFloatOverride(metaWindow, withWmId); if (!this.isActiveWindowWorkspaceTiled(metaWindow)) { nodeWindow.mode = WINDOW_MODES.FLOAT; } else { nodeWindow.mode = WINDOW_MODES.TILE; } } else { - this.addFloatOverride(metaWindow, nonPersistent); + this.addFloatOverride(metaWindow, withWmId); nodeWindow.mode = WINDOW_MODES.FLOAT; } } From 3bf968e20dbb0dfeec5a175121ed7cc7b0152ebb Mon Sep 17 00:00:00 2001 From: S1m Date: Wed, 24 Jan 2024 21:08:39 +0100 Subject: [PATCH 2/3] Fix error 'metaWindow.get_title is not a function' This was the cause of ghosts windows with dynamic workspaces: Closing a window in a workspace reduced the number of workspaces above it. Windows in these workspaces considered that there was still another window, and finished tiling with a ghost window. --- lib/extension/window.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/extension/window.js b/lib/extension/window.js index 7dadde6..65276c4 100644 --- a/lib/extension/window.js +++ b/lib/extension/window.js @@ -1611,10 +1611,10 @@ export class WindowManager extends GObject.Object { let nodeWindow; nodeWindow = this.tree.findNodeByActor(actor); - if (nodeWindow) { + if (nodeWindow && nodeWindow.isWindow()) { this.tree.removeNode(nodeWindow); this.renderTree("window-destroy-quick", true); - this.removeFloatOverride(nodeWindow, false, true); + this.removeFloatOverride(nodeWindow.nodeValue, true); } // find the next attachNode here From 8c03554a3298d1c1964ac457c786da06459fa42e Mon Sep 17 00:00:00 2001 From: S1m <31284753+p1gp1g@users.noreply.github.com> Date: Thu, 8 Feb 2024 13:36:57 +0100 Subject: [PATCH 3/3] Use optional chaining MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Benny Powers - עם ישראל חי! --- lib/extension/window.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/extension/window.js b/lib/extension/window.js index 65276c4..55c02a3 100644 --- a/lib/extension/window.js +++ b/lib/extension/window.js @@ -1611,7 +1611,7 @@ export class WindowManager extends GObject.Object { let nodeWindow; nodeWindow = this.tree.findNodeByActor(actor); - if (nodeWindow && nodeWindow.isWindow()) { + if (nodeWindow?.isWindow()) { this.tree.removeNode(nodeWindow); this.renderTree("window-destroy-quick", true); this.removeFloatOverride(nodeWindow.nodeValue, true);