]> Freerunner's - simpledwindle.git/commitdiff
support window-titles for filtering main
authorAndre Ramnitz <andre.ramnitz@mail.de>
Mon, 26 Oct 2026 04:54:39 +0000 (05:54 +0100)
committerAndre Ramnitz <andre.ramnitz@mail.de>
Mon, 26 Oct 2026 04:54:39 +0000 (05:54 +0100)
contents/code/main.js
metadata.json

index 7e2dae4..1b35e6e 100644 (file)
@@ -7,7 +7,7 @@
 
 "use strict";
 
-const VERSION = "0.7.1";
+const VERSION = "0.7.2";
 
 // ------------------------------------------------------------
 // Configuration
@@ -16,6 +16,9 @@ const VERSION = "0.7.1";
 // info: nomenclature in kwin is
 // class/appid => resourceClass
 //       title => caption
+// Exception entries: class, regex, or [class, title].
+// An omitted title matches any caption; use /.*/ explicitly if preferred.
+// Strings match exactly (case-insensitive); regexes match patterns.
 
 const GAP = 8;
 const RESIZE_STEP = 0.05;
@@ -25,6 +28,8 @@ const MIN_RATIO = 0.15;
 const FLOATING_CLASSES = [
     // "org.kde.dolphin",
     // /^org\.kde.*/,
+    "kcm_klassydecoration",
+    "klassy-settings",
     /^com\.system76\..*/,
     "org.kde.dolphin",
     "org.kde.ark",
@@ -44,6 +49,7 @@ const FLOATING_CLASSES = [
     "ncmpcpp",
     "io.missioncenter.MissionCenter",
     "be.alexandervanhee.gradia",
+    ["firefox-bin", "Bild-im-Bild"],
 ];
 
 // Completely ignored by SimpleDwindle
@@ -102,14 +108,23 @@ function windowClass(w) {
     return String(w.resourceClass || "").toLowerCase();
 }
 
+function matchesPattern(value, pattern) {
+    if (pattern instanceof RegExp) {
+        pattern.lastIndex = 0;
+        return pattern.test(value);
+    }
+
+    return String(pattern).toLowerCase() === value.toLowerCase();
+}
+
 function matchesClass(w, classes) {
     const name = windowClass(w);
+    const title = String(w.caption || "");
 
     return classes.some(entry => {
-        if (entry instanceof RegExp)
-            return entry.test(name);
-
-        return String(entry).toLowerCase() === name;
+        const pair = Array.isArray(entry) ? entry : [entry];
+        return matchesPattern(name, pair[0]) &&
+               (pair.length < 2 || matchesPattern(title, pair[1]));
     });
 }
 
index 7473937..4169397 100644 (file)
@@ -3,7 +3,7 @@
     "Id": "simpledwindle",
     "Name": "SimpleDwindle",
     "Description": "Minimal tiling and floating window manager",
-    "Version": "0.7.1",
+    "Version": "0.7.2",
     "License": "GPLv3"
   },
   "X-Plasma-API": "javascript",