sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

commit 4d2daac3ed1a6086796343a5a98c0bd7a553886e
parent 5c223b38668f0316a724adb5c1b8c18b5e571e9c
Author: Natanael J. Rabello <natanaeljrabello@gmail.com>
Date:   Mon,  2 Aug 2021 09:15:41 -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@gmail.com>

Diffstat:
Adwm.suckless.org/patches/floatrules/dwm-floatrules-20210801-138b405.diff | 71+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mdwm.suckless.org/patches/floatrules/index.md | 5+++++
2 files changed, 76 insertions(+), 0 deletions(-)

diff --git a/dwm.suckless.org/patches/floatrules/dwm-floatrules-20210801-138b405.diff b/dwm.suckless.org/patches/floatrules/dwm-floatrules-20210801-138b405.diff @@ -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 +@@ -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 +@@ -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; +@@ -139,6 +141,8 @@ typedef struct { + unsigned int tags; + int isfloating; + int monitor; ++ int floatx, floaty, floatw, floath; ++ int floatborderpx; + } Rule; + + /* function declarations */ +@@ -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; +@@ -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 @@ -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) @@ -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) @@ -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.