[wiki] [sites] fixed bug in patch (window does not stay on tags without rule) || Lars Niesen

From: <git_AT_suckless.org>
Date: Thu, 09 Dec 2021 13:47:12 +0100

commit 51496b2d44d97c74cbd862f921f6f2cfaa53a9f8
Author: Lars Niesen <lars.niesen_AT_gmx.de>
Date: Thu Dec 9 13:47:54 2021 +0100

    fixed bug in patch (window does not stay on tags without rule)

diff --git a/dwm.suckless.org/patches/rulerefresher/dwm-rulerefresher-6.2.diff b/dwm.suckless.org/patches/rulerefresher/dwm-rulerefresher-6.2.diff
index 9de9f3ab..14e78d90 100644
--- a/dwm.suckless.org/patches/rulerefresher/dwm-rulerefresher-6.2.diff
+++ b/dwm.suckless.org/patches/rulerefresher/dwm-rulerefresher-6.2.diff
_AT_@ -1,14 +1,14 @@
-From 94b9518be54da9c52d59465f41c403c6e35efb9f Mon Sep 17 00:00:00 2001
+From 5728e3bc46ef38cfcc0f2cbf04626a28ecc57379 Mon Sep 17 00:00:00 2001
 From: Lars Niesen <lars.niesen_AT_gmx.de>
-Date: Fri, 3 Dec 2021 12:15:04 +0100
-Subject: [PATCH] rerun rules on window name chage
+Date: Thu, 9 Dec 2021 13:40:17 +0100
+Subject: [PATCH] rulerefresher
 
 ---
- dwm.c | 12 ++++++++++++
- 1 file changed, 12 insertions(+)
+ dwm.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 50 insertions(+)
 
 diff --git a/dwm.c b/dwm.c
-index 4465af1..8fab7e3 100644
+index 4465af1..5f8ba9c 100644
 --- a/dwm.c
 +++ b/dwm.c
 _AT_@ -223,6 +223,7 @@ static int updategeom(void);
_AT_@ -27,14 +27,52 @@ index 4465af1..8fab7e3 100644
                          if (c == c->mon->sel)
                                  drawbar(c->mon);
                  }
-_AT_@ -1992,6 +1994,16 @@ updatestatus(void)
+_AT_@ -1992,6 +1994,54 @@ updatestatus(void)
          drawbar(selmon);
  }
  
 +void
 +updaterules(Client *c)
 +{
-+ applyrules(c);
++ //applyrules(c)
++ const char *class, *instance;
++ unsigned int i;
++ const Rule *r;
++ Monitor *m;
++ XClassHint ch = { NULL, NULL };
++
++ /* rule matching */
++ XGetClassHint(dpy, c->win, &ch);
++ class = ch.res_class ? ch.res_class : broken;
++ instance = ch.res_name ? ch.res_name : broken;
++ char found_rule = 0;
++
++ 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)))
++ {
++ c->isfloating = r->isfloating;
++
++ if(!found_rule)
++ {
++ c->tags=0;
++ found_rule=1;
++ }
++ c->tags |= r->tags;
++ for (m = mons; m && m->num != r->monitor; m = m->next);
++ if (m)
++ c->mon = m;
++ }
++ }
++ if (ch.res_class)
++ XFree(ch.res_class);
++ if (ch.res_name)
++ XFree(ch.res_name);
++ c->tags = c->tags & TAGMASK ? c->tags & TAGMASK : c->mon->tagset[c->mon->seltags];
++
++ // end apply rules
 + if (c->isfloating)
 + resize(c, c->x, c->y,
 + c->w, c->h, 0);
diff --git a/dwm.suckless.org/patches/rulerefresher/index.md b/dwm.suckless.org/patches/rulerefresher/index.md
index 99e82d19..2f0473c6 100644
--- a/dwm.suckless.org/patches/rulerefresher/index.md
+++ b/dwm.suckless.org/patches/rulerefresher/index.md
_AT_@ -17,7 +17,7 @@ With this patch the rules are reapplied after the rename.
 
 Download
 --------
-* [dwm-rulerefresher-6.2.diff](dwm-rulerefresher-6.2.diff)(2021-12-03)
+* [dwm-rulerefresher-6.2.diff](dwm-rulerefresher-6.2.diff)(2021-12-09)
 
 Author
 ------
Received on Thu Dec 09 2021 - 13:47:12 CET

This archive was generated by hypermail 2.3.0 : Thu Dec 09 2021 - 13:48:44 CET