]> Freerunner's - simpledwindle.git/commitdiff
initial commit: poc
authorAndre Ramnitz <andre.ramnitz@mail.de>
Mon, 19 Oct 2026 16:26:40 +0000 (18:26 +0200)
committerAndre Ramnitz <andre.ramnitz@mail.de>
Mon, 19 Oct 2026 16:26:40 +0000 (18:26 +0200)
contents/code/main.js [new file with mode: 0644]
metadata.json [new file with mode: 0644]

diff --git a/contents/code/main.js b/contents/code/main.js
new file mode 100644 (file)
index 0000000..33f3a4d
--- /dev/null
@@ -0,0 +1,77 @@
+
+"use strict";
+
+// SimpleDwindle 0.1
+// Proof of Concept: Tiling / Floating Z-order
+
+const tiledWindows = [];
+
+function log(message) {
+    print("[SimpleDwindle] " + message);
+}
+
+function isCandidate(window) {
+    return window && window.normalWindow &&
+           !window.fullScreen;
+}
+
+function isTiled(window) {
+    return tiledWindows.indexOf(window) !== -1;
+}
+
+function setTiled(window) {
+    if (!isCandidate(window) || isTiled(window))
+        return;
+
+    tiledWindows.push(window);
+
+    window.keepAbove = false;
+    window.keepBelow = true;
+
+    log("TILED: " + window.caption);
+}
+
+function setFloating(window) {
+    const index = tiledWindows.indexOf(window);
+
+    if (index === -1)
+        return;
+
+    tiledWindows.splice(index, 1);
+
+    window.keepBelow = false;
+
+    log("FLOATING: " + window.caption);
+}
+
+function toggleFloating() {
+    const window = workspace.activeWindow;
+
+    if (!window)
+        return;
+
+    if (isTiled(window))
+        setFloating(window);
+    else
+        setTiled(window);
+}
+
+// Remove closed windows from our list
+workspace.windowRemoved.connect(function(window) {
+    const index = tiledWindows.indexOf(window);
+
+    if (index !== -1)
+        tiledWindows.splice(index, 1);
+});
+
+// Keyboard shortcut
+registerShortcut(
+    "SimpleDwindleToggleFloating",
+    "SimpleDwindle: Toggle Floating",
+    "Meta+S",
+    toggleFloating
+);
+
+log("Version 0.1 initialized");
+
+
diff --git a/metadata.json b/metadata.json
new file mode 100644 (file)
index 0000000..8cf7a7d
--- /dev/null
@@ -0,0 +1,13 @@
+{
+  "KPlugin": {
+    "Id": "simpledwindle",
+    "Name": "SimpleDwindle",
+    "Description": "Minimal tiling and floating window manager",
+    "Version": "0.1",
+    "License": "MIT"
+  },
+  "X-Plasma-API": "javascript",
+  "X-Plasma-MainScript": "code/main.js",
+  "KPackageStructure": "KWin/Script"
+}
+