diff options
| author | tslil clingman <> | 2023-12-02 11:41:30 +0100 |
|---|---|---|
| committer | tslil clingman <> | 2023-12-02 11:41:30 +0100 |
| commit | 0e5372cda8904d0899983bd5d7ba86704a5e15c9 (patch) | |
| tree | 360b5e22ef37ed59964e30262449ba19f59abcb8 /dwl/correctly-match-blank-rule-strings.patch | |
| parent | 57d7581edc6312f30edbe4d5fec0a8310cc8cacc (diff) | |
[dwl] another patch, laptop config
Diffstat (limited to 'dwl/correctly-match-blank-rule-strings.patch')
| -rw-r--r-- | dwl/correctly-match-blank-rule-strings.patch | 35 |
1 files changed, 35 insertions, 0 deletions
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 + |
