commit de4ea03cfa7677b358955a2b4bbf0c5e436eecca
parent b48448935de602c8d248623b097ee549f5e04276
Author: MaliCopter <mali.copter@gmx.de>
Date: Sat, 10 Oct 2026 17:15:47 +0200
[dwm][patch] Cleaned up Ruleregex patch
Diffstat:
2 files changed, 53 insertions(+), 1 deletion(-)
diff --git a/dwm.suckless.org/patches/ruleregex/dwm-ruleregex-20261010-bf78dff.diff b/dwm.suckless.org/patches/ruleregex/dwm-ruleregex-20261010-bf78dff.diff
@@ -0,0 +1,51 @@
+From bf78dff9137dd705bfd15319a2ce0318fc122852 Mon Sep 17 00:00:00 2001
+From: MaliCopter <mali.copter@gmx.de>
+Date: Sat, 10 Oct 2026 16:55:11 +0200
+Subject: [PATCH] Rewrote Ruleregex patch for cleaner code
+
+---
+ dwm.c | 21 ++++++++++++++++++---
+ 1 file changed, 18 insertions(+), 3 deletions(-)
+
+diff --git a/dwm.c b/dwm.c
+index ab3a84c..3ac731c 100644
+--- a/dwm.c
++++ b/dwm.c
+@@ -274,6 +274,21 @@ static Window root, wmcheckwin;
+ struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
+
+ /* function implementations */
++int
++applyregex(const char *name, const char *pattern)
++{
++ regex_t re;
++ int result;
++
++ if (regcomp(&re, pattern, REG_EXTENDED) != 0) goto fail;
++ result = regexec(&re, name, 0, NULL, 0);
++ regfree(&re);
++ if (result == 0) return 1;
++
++ fail:
++ return strstr(name, pattern) != NULL;
++}
++
+ void
+ applyrules(Client *c)
+ {
+@@ -292,9 +307,9 @@ applyrules(Client *c)
+
+ for (i = 0; i < LENGTH(rules); i++) {
+ r = &rules[i];
+- if ((!r->title || strstr(c->name, r->title))
+- && (!r->class || strstr(class, r->class))
+- && (!r->instance || strstr(instance, r->instance)))
++ if ((!r->title || applyregex(c->name, r->title))
++ && (!r->class || applyregex(class, r->class))
++ && (!r->instance || applyregex(instance, r->instance)))
+ {
+ c->isfloating = r->isfloating;
+ c->tags |= r->tags;
+--
+2.55.0
+
diff --git a/dwm.suckless.org/patches/ruleregex/index.md b/dwm.suckless.org/patches/ruleregex/index.md
@@ -8,7 +8,8 @@ instead of simple string matching.
Download
--------
-* [dwm-ruleregex-20260508-44a91a2.diff](dwm-ruleregex-20260508-44a91a2.diff)
+* [dwm-ruleregex-20261010-bf78dff.diff](dwm-ruleregex-20261010-bf78dff.diff) (2026-10-10) *latest*
+* [dwm-ruleregex-20260508-44a91a2.diff](dwm-ruleregex-20260508-44a91a2.diff) (2026-05-08) *deprecated*
Authors
-------