From: Andre Ramnitz Date: Mon, 26 Oct 2026 04:54:39 +0000 (+0100) Subject: support window-titles for filtering X-Git-Url: https://git.ramnitz.eu/?a=commitdiff_plain;h=a4eddfcc65df20dbe195199fb5bbab543a89a600;p=simpledwindle.git support window-titles for filtering --- diff --git a/contents/code/main.js b/contents/code/main.js index 7e2dae4..1b35e6e 100644 --- a/contents/code/main.js +++ b/contents/code/main.js @@ -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])); }); } diff --git a/metadata.json b/metadata.json index 7473937..4169397 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.1", + "Version": "0.7.2", "License": "GPLv3" }, "X-Plasma-API": "javascript",