]> Freerunner's - simpledwindle.git/commitdiff
bugfix: tiled windows being moved to another workspace can't resize
authorAndre Ramnitz <andre.ramnitz@mail.de>
Thu, 22 Oct 2026 16:26:19 +0000 (18:26 +0200)
committerAndre Ramnitz <andre.ramnitz@mail.de>
Thu, 22 Oct 2026 17:39:38 +0000 (19:39 +0200)
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.

contents/code/main.js
metadata.json

index c2217f9..fed0988 100644 (file)
@@ -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);
index d80312f..7473937 100644 (file)
@@ -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",