sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

commit 54a55c4a65a82454403d81daca5531db43f7902d
parent 065222db3866d5586912dec920dd7eeeb647f260
Author: MaliCopter <mali.copter@gmx.de>
Date:   Sun, 11 Oct 2026 14:06:37 +0200

[dwm][patch] ruleregex header and matching fix

Diffstat:
Ddwm.suckless.org/patches/ruleregex/dwm-ruleregex-20261010-bf78dff.diff | 51---------------------------------------------------
Adwm.suckless.org/patches/ruleregex/dwm-ruleregex-20261011-a83e54e.diff | 92+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mdwm.suckless.org/patches/ruleregex/index.md | 2+-
3 files changed, 93 insertions(+), 52 deletions(-)

diff --git a/dwm.suckless.org/patches/ruleregex/dwm-ruleregex-20261010-bf78dff.diff b/dwm.suckless.org/patches/ruleregex/dwm-ruleregex-20261010-bf78dff.diff @@ -1,51 +0,0 @@ -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/dwm-ruleregex-20261011-a83e54e.diff b/dwm.suckless.org/patches/ruleregex/dwm-ruleregex-20261011-a83e54e.diff @@ -0,0 +1,92 @@ +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 1/2] 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 + + +From a83e54e545d4766dcc18c27be35e7689d9a9ca95 Mon Sep 17 00:00:00 2001 +From: MaliCopter <mali.copter@gmx.de> +Date: Sun, 11 Oct 2026 13:54:15 +0200 +Subject: [PATCH 2/2] dwm ruleregex (hopefully) final fix + +--- + dwm.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/dwm.c b/dwm.c +index 3ac731c..aea3cc4 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -28,6 +28,7 @@ + #include <stdlib.h> + #include <string.h> + #include <unistd.h> ++#include <regex.h> + #include <sys/types.h> + #include <sys/wait.h> + #include <X11/cursorfont.h> +@@ -280,13 +281,13 @@ applyregex(const char *name, const char *pattern) + regex_t re; + int result; + +- if (regcomp(&re, pattern, REG_EXTENDED) != 0) goto fail; ++ result = regcomp(&re, pattern, REG_EXTENDED | REG_NOSUB); ++ if (result != 0) return strstr(name, pattern) != NULL; + result = regexec(&re, name, 0, NULL, 0); + regfree(&re); + if (result == 0) return 1; + +- fail: +- return strstr(name, pattern) != NULL; ++ return 0; + } + + void +-- +2.55.0 diff --git a/dwm.suckless.org/patches/ruleregex/index.md b/dwm.suckless.org/patches/ruleregex/index.md @@ -8,7 +8,7 @@ instead of simple string matching. Download -------- -* [dwm-ruleregex-20261010-bf78dff.diff](dwm-ruleregex-20261010-bf78dff.diff) (2026-10-10) *latest* +* [dwm-ruleregex-20261011-a83e54e.diff](dwm-ruleregex-20261011-a83e54e.diff) (2026-10-11) *latest* * [dwm-ruleregex-20260508-44a91a2.diff](dwm-ruleregex-20260508-44a91a2.diff) (2026-05-08) *deprecated* Authors