// SimpleDwindle
// KWin 6.8 - Minimal chronological Dwindle
-const VERSION = "0.5.1";
+const VERSION = "0.5.2";
// ------------------------------------------------------------
// Configuration
const floating = [];
const suspended = [];
const watched = [];
+const interactiveMoves = new Map();
// ------------------------------------------------------------
// Helpers
w.outputChanged.connect(function() {
handleWindowLocationChanged(w);
});
+
+ w.interactiveMoveResizeStarted.connect(function() {
+ handleInteractiveStart(w);
+ });
+
+ w.interactiveMoveResizeFinished.connect(function() {
+ handleInteractiveFinish(w);
+ });
}
function handleWindowAdded(w) {
}
function handleWindowRemoved(w) {
+ interactiveMoves.delete(w);
detachWindow(w);
removeFromList(floating, w);
removeFromList(watched, w);
}
+// ------------------------------------------------------------
+// Interactive moves
+// ------------------------------------------------------------
+
+// Only react to KWin's user-driven move/resize lifecycle. Layout
+// assignments to frameGeometry do not emit these window signals.
+function handleInteractiveStart(w) {
+ if (!contains(managed, w) || w.fullScreen || w.minimized)
+ return;
+
+ const r = w.frameGeometry;
+ interactiveMoves.set(w, {
+ x: r.x, y: r.y, width: r.width, height: r.height
+ });
+}
+
+function handleInteractiveFinish(w) {
+ const before = interactiveMoves.get(w);
+ interactiveMoves.delete(w);
+
+ if (!before || !contains(managed, w))
+ return;
+
+ const after = w.frameGeometry;
+ const moved = Math.abs(after.x - before.x) > 1 ||
+ Math.abs(after.y - before.y) > 1;
+ const resized = Math.abs(after.width - before.width) > 1 ||
+ Math.abs(after.height - before.height) > 1;
+
+ // Do not interpret an interactive resize as a move-to-floating.
+ if (moved && !resized) {
+ floatWindow(w);
+ log("DRAGGED/FLOATING: " + w.caption);
+ }
+}
+
// ------------------------------------------------------------
// Events
// ------------------------------------------------------------