From 0e5372cda8904d0899983bd5d7ba86704a5e15c9 Mon Sep 17 00:00:00 2001 From: tslil clingman <> Date: Sat, 2 Dec 2023 11:41:30 +0100 Subject: [dwl] another patch, laptop config --- dwl/correctly-match-blank-rule-strings.patch | 35 ++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 dwl/correctly-match-blank-rule-strings.patch (limited to 'dwl/correctly-match-blank-rule-strings.patch') diff --git a/dwl/correctly-match-blank-rule-strings.patch b/dwl/correctly-match-blank-rule-strings.patch new file mode 100644 index 0000000..f9b3144 --- /dev/null +++ b/dwl/correctly-match-blank-rule-strings.patch @@ -0,0 +1,35 @@ +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 + -- cgit v1.2.3