From: Andre Ramnitz Date: Mon, 19 Oct 2026 19:34:09 +0000 (+0200) Subject: Allow regex for FLOATING and IGNORED classes X-Git-Url: https://git.ramnitz.eu/?a=commitdiff_plain;h=7114c3a32e46a72d075f160fbbd48cd13597dadf;p=simpledwindle.git Allow regex for FLOATING and IGNORED classes remove redundant log entries --- diff --git a/contents/code/main.js b/contents/code/main.js index 5016ed7..a44ffb9 100644 --- a/contents/code/main.js +++ b/contents/code/main.js @@ -1,25 +1,45 @@ "use strict"; // SimpleDwindle -const VERSION = "0.3.2"; +const VERSION = "0.3.3"; // KWin 6.8 - Minimal chronological Dwindle // ------------------------------------------------------------ // Configuration // ------------------------------------------------------------ +// info: nomenclature in kwin is +// class/appid => resourceClass +// title => caption + const GAP = 8; -// Always floating, never tiled +// Floating by default, manually tileable via Meta+S const FLOATING_CLASSES = [ // "org.kde.dolphin", "org.kde.kcalc", "systemsettings", + "okular", + "dolphin", + "qtpass", + "alsa-scarlett-gui", + "lstopo", + "LACT", + "ncmpcpp", + "MissionCenter", + "gradia", ]; // Completely ignored by SimpleDwindle const IGNORED_CLASSES = [ "wl-copy", + "steam", + "heroic", + /^steam_app.*$/, + /^.*\.exe$/i, + /^xdg-desktop-portal/, + /clipboard/i, + /^org\.kde\.spectacle$/, ]; // ------------------------------------------------------------ @@ -56,9 +76,14 @@ function windowClass(w) { } function matchesClass(w, classes) { - return classes.some(c => - c.toLowerCase() === windowClass(w) - ); + const name = windowClass(w); + + return classes.some(entry => { + if (entry instanceof RegExp) + return entry.test(name); + + return String(entry).toLowerCase() === name; + }); } function isCandidate(w) { @@ -314,8 +339,6 @@ function arrange(layout) { // ------------------------------------------------------------ function tileWindow(w) { - log("TILED: " + w.caption + " [" + w.resourceClass + "]"); - if (!isCandidate(w) || isIgnored(w) || contains(managed, w) || @@ -338,7 +361,7 @@ function tileWindow(w) { arrange(layout); - log("TILED: " + w.caption); + log("TILED: " + w.caption + " [" + w.resourceClass + "]"); } function detachWindow(w) { @@ -463,12 +486,12 @@ function watchWindow(w) { function handleWindowAdded(w) { log( - "WINDOW ADDED: " + - "caption=" + w.caption + - " class=" + w.resourceClass + - " normal=" + w.normalWindow + - " transient=" + Boolean(w.transient) + - " id=" + w.internalId + "WINDOW ADDED: " + + "caption=" + w.caption + + " class=" + w.resourceClass + + " normal=" + w.normalWindow + + " transient=" + Boolean(w.transient) + + " id=" + w.internalId ); if (!isCandidate(w) || isIgnored(w)) return; diff --git a/metadata.json b/metadata.json index f26011c..2a1b53d 100644 --- a/metadata.json +++ b/metadata.json @@ -3,7 +3,7 @@ "Id": "simpledwindle", "Name": "SimpleDwindle", "Description": "Minimal tiling and floating window manager", - "Version": "0.3.1", + "Version": "0.3.3", "License": "MIT" }, "X-Plasma-API": "javascript",