From: Andre Ramnitz Date: Thu, 22 Oct 2026 16:26:19 +0000 (+0200) Subject: bugfix: tiled windows being moved to another workspace can't resize X-Git-Url: https://git.ramnitz.eu/?a=commitdiff_plain;h=8fc6cec4996fdd948d65908b1db3bd2ca80e457d;p=simpledwindle.git bugfix: tiled windows being moved to another workspace can't resize due to the workspace being invisible at that point of time. Flag the binary tree dirty while it is not focused and trigger a reconstruction if it becomes visible. --- diff --git a/contents/code/main.js b/contents/code/main.js index c2217f9..fed0988 100644 --- a/contents/code/main.js +++ b/contents/code/main.js @@ -9,7 +9,7 @@ // SimpleDwindle // KWin 6.8 - Minimal chronological Dwindle -const VERSION = "0.7.0"; +const VERSION = "0.7.1"; // ------------------------------------------------------------ // Configuration @@ -74,6 +74,7 @@ const watched = []; const interactiveMoves = new Map(); const multiDesktop = []; const quarantinedLayouts = new Set(); +const dirtyLayouts = new Set(); const SYNC_DELAY_MS = 50; let syncSerial = 0; let pendingSync = null; @@ -392,6 +393,17 @@ function applyNode(node, rect, rootWide = false, isRoot = true, skipWindow = nul } } +// An inactive desktop's geometry is applied when it becomes visible. +function arrangeOrDefer(layout) { + if (!layout) return; + if (layout.desktop !== workspace.currentDesktop) { + dirtyLayouts.add(layout); + return; + } + arrange(layout); + dirtyLayouts.delete(layout); +} + function arrange(layout, skipWindow = null) { if (!layout || quarantinedLayouts.has(layout) || !layout.root) return; @@ -979,13 +991,14 @@ function reconcileWindow(w) { if (oldLayout) { removeNode(oldLayout, w); normalizeSplits(oldLayout.root); - arrange(oldLayout); + arrangeOrDefer(oldLayout); } const target = layoutFor(w); insertWindow(target, w); normalizeSplits(target.root); - arrange(target); - log("MOVED/TILED: " + w.caption); + arrangeOrDefer(target); + log("MOVED/TILED: " + w.caption + + " targetDirty=" + dirtyLayouts.has(target)); return 1; } @@ -1139,6 +1152,20 @@ function handleInteractiveFinish(w) { workspace.windowAdded.connect(handleWindowAdded); workspace.windowRemoved.connect(handleWindowRemoved); +// KWin does not activate the destination desktop when moving a window. +// Reapply the destination tree once its desktop actually becomes active. +workspace.currentDesktopChanged.connect(function() { + let applied = 0; + for (const layout of layouts) { + if (layout.desktop !== workspace.currentDesktop) continue; + if (!layout.root || quarantinedLayouts.has(layout)) continue; + arrange(layout); + dirtyLayouts.delete(layout); + applied++; + } + log("DESKTOP ACTIVATED: arranged=" + applied); +}); + workspace.screensChanged.connect(function() { for (const layout of layouts) arrange(layout); diff --git a/metadata.json b/metadata.json index d80312f..7473937 100644 --- a/metadata.json +++ b/metadata.json @@ -3,7 +3,7 @@ "Id": "simpledwindle", "Name": "SimpleDwindle", "Description": "Minimal tiling and floating window manager", - "Version": "0.7.0", + "Version": "0.7.1", "License": "GPLv3" }, "X-Plasma-API": "javascript",