[wiki] [sites] [dwm][patch][floatrules] Bugfix and Improvement || Natanael J. Rabello
commit 4d2daac3ed1a6086796343a5a98c0bd7a553886e
Author: Natanael J. Rabello <natanaeljrabello_AT_gmail.com>
Date: Mon Aug 2 09:15:41 2021 -0300
[dwm][patch][floatrules] Bugfix and Improvement
New diff with bugfix and support for -1 in float xywh values.
Signed-off-by: Natanael J. Rabello <natanaeljrabello_AT_gmail.com>
diff --git a/dwm.suckless.org/patches/floatrules/dwm-floatrules-20210801-138b405.diff b/dwm.suckless.org/patches/floatrules/dwm-floatrules-20210801-138b405.diff
new file mode 100644
index 00000000..2bf943f5
--- /dev/null
+++ b/dwm.suckless.org/patches/floatrules/dwm-floatrules-20210801-138b405.diff
_AT_@ -0,0 +1,71 @@
+diff --git a/config.def.h b/config.def.h
+index a2ac963..e8c0978 100644
+--- a/config.def.h
++++ b/config.def.h
+_AT_@ -26,9 +26,9 @@ static const Rule rules[] = {
+ * WM_CLASS(STRING) = instance, class
+ * WM_NAME(STRING) = title
+ */
+- /* class instance title tags mask isfloating monitor */
+- { "Gimp", NULL, NULL, 0, 1, -1 },
+- { "Firefox", NULL, NULL, 1 << 8, 0, -1 },
++ /* class instance title tags mask isfloating monitor float x,y,w,h floatborderpx*/
++ { "Gimp", NULL, NULL, 0, 1, -1, 50,50,500,500, 5 },
++ { "Firefox", NULL, NULL, 1 << 8, 0, -1, 50,50,500,500, 5 },
+ };
+
+ /* layout(s) */
+diff --git a/dwm.c b/dwm.c
+index 5e4d494..a03ca15 100644
+--- a/dwm.c
++++ b/dwm.c
+_AT_@ -93,6 +93,8 @@ struct Client {
+ int bw, oldbw;
+ unsigned int tags;
+ int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
++ int floatborderpx;
++ int hasfloatbw;
+ Client *next;
+ Client *snext;
+ Monitor *mon;
+_AT_@ -139,6 +141,8 @@ typedef struct {
+ unsigned int tags;
+ int isfloating;
+ int monitor;
++ int floatx, floaty, floatw, floath;
++ int floatborderpx;
+ } Rule;
+
+ /* function declarations */
+_AT_@ -300,6 +304,16 @@ applyrules(Client *c)
+ {
+ c->isfloating = r->isfloating;
+ c->tags |= r->tags;
++ if (r->floatborderpx >= 0) {
++ c->floatborderpx = r->floatborderpx;
++ c->hasfloatbw = 1;
++ }
++ if (r->isfloating) {
++ if (r->floatx >= 0) c->x = c->mon->mx + r->floatx;
++ if (r->floaty >= 0) c->y = c->mon->my + r->floaty;
++ if (r->floatw >= 0) c->w = r->floatw;
++ if (r->floath >= 0) c->h = r->floath;
++ }
+ for (m = mons; m && m->num != r->monitor; m = m->next);
+ if (m)
+ c->mon = m;
+_AT_@ -1282,7 +1296,10 @@ resizeclient(Client *c, int x, int y, int w, int h)
+ c->oldy = c->y; c->y = wc.y = y;
+ c->oldw = c->w; c->w = wc.width = w;
+ c->oldh = c->h; c->h = wc.height = h;
+- wc.border_width = c->bw;
++ if (c->isfloating && c->hasfloatbw && !c->isfullscreen)
++ wc.border_width = c->floatborderpx;
++ else
++ wc.border_width = c->bw;
+ XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
+ configure(c);
+ XSync(dpy, False);
+--
+2.32.0
+
diff --git a/dwm.suckless.org/patches/floatrules/index.md b/dwm.suckless.org/patches/floatrules/index.md
index a84a2742..b8b50f34 100644
--- a/dwm.suckless.org/patches/floatrules/index.md
+++ b/dwm.suckless.org/patches/floatrules/index.md
_AT_@ -13,6 +13,9 @@ Setting `floatborderpx` to `-1` (or any value less than zero) will mean that the
Please note that this patch needs `rm config.h` to be added to the `Makefile`.
+\[since dwm-floatrules-20210801-138b405.diff\]:
+Setting any of `floatx`, `floaty`, `floatw`, `floath` to `-1` (or any value less than zero) will mean that the geometry parameter should not be overwritten.
+
Screenshots:
![floatrules screenshot](floatrules.png)
_AT_@ -34,6 +37,7 @@ Updates
Download
--------
+* [dwm-floatrules-20210801-138b405.diff](dwm-floatrules-20210801-138b405.diff)
* [dwm-floatrules-20201119-d08dd9c.diff](dwm-floatrules-20201119-d08dd9c.diff)
* [dwm-floatrules-20201114-d08dd9c.diff](dwm-floatrules-20201114-d08dd9c.diff)
* [dwm-floatrules-20201107-61bb8b2.diff](dwm-floatrules-20201107-61bb8b2.diff)
_AT_@ -43,5 +47,6 @@ Author
------
* Alex Cole (original) <ajzcole at airmail.cc>
* Jakub Profota
+* Natanael J Rabello
The original author would like to apologise for the several bugs that originally plagued even this relatively simple patch.
Received on Mon Aug 02 2021 - 14:17:48 CEST
This archive was generated by hypermail 2.3.0
: Mon Aug 02 2021 - 14:24:43 CEST