From 7cc541eb1092ba17bfe3d5afa77e609cda832016 Mon Sep 17 00:00:00 2001 From: tslil clingman <> Date: Sat, 2 Dec 2023 10:57:35 +0100 Subject: [PATCH 1/1] correctly match blank rule strings The bug before-hand was that specifying a blank rule string would match against any string (strstr(foo, "") is always true apparently), even though we already had a special case for !r->title and !r->id. This patch now sets the behaviour to r->title/r->id == NULL means match all, blank means match blank --- dwl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dwl.c b/dwl.c index 03e999e..5a2a538 100644 --- a/dwl.c +++ b/dwl.c @@ -442,9 +442,10 @@ applyrules(Client *c) if (!(title = client_get_title(c))) title = broken; +#define MATCH(str1, str2) ((str2[0]==0 && str1[0]==0) || (str2[0] != 0 && strstr(str1, str2))) for (r = rules; r < END(rules); r++) { - if ((!r->title || strstr(title, r->title)) - && (!r->id || strstr(appid, r->id))) { + if ((!r->title || MATCH(title, r->title)) + && (!r->id || MATCH(appid, r->id))) { c->isfloating = r->isfloating; newtags |= r->tags; i = 0; -- 2.43.0