[wiki] [sites] [dwm][patch][clientresizehints] resizehints per app || Fred Frey
 
commit a18052689f3bc912b63e9a65e52998b0e5e756b7
Author: Fred Frey <fred_AT_fpf3.net>
Date:   Sun Sep 22 16:45:44 2024 -0400
    [dwm][patch][clientresizehints] resizehints per app
diff --git a/dwm.suckless.org/patches/clientresizehints/dwm-clientresizehints-6.5.diff b/dwm.suckless.org/patches/clientresizehints/dwm-clientresizehints-6.5.diff
new file mode 100644
index 00000000..b05c84d2
--- /dev/null
+++ b/dwm.suckless.org/patches/clientresizehints/dwm-clientresizehints-6.5.diff
_AT_@ -0,0 +1,76 @@
+From b2de13e11e7b4d67b4982ef51befa87ed9202080 Mon Sep 17 00:00:00 2001
+From: Fred Frey <fred_AT_fpf3.net>
+Date: Sun, 22 Sep 2024 16:09:53 -0400
+Subject: [PATCH] implement per-client resizehints
+
+---
+ config.def.h | 6 +++---
+ dwm.c        | 7 +++++--
+ 2 files changed, 8 insertions(+), 5 deletions(-)
+
+diff --git a/config.def.h b/config.def.h
+index 9efa774..67e7a9c 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    resizehints */
++	{ "Gimp",     NULL,       NULL,       0,            1,           -1,        1},
++	{ "Firefox",  NULL,       NULL,       1 << 8,       0,           -1,        1},
+ };
+ 
+ /* layout(s) */
+diff --git a/dwm.c b/dwm.c
+index 67c6b2b..f179b4c 100644
+--- a/dwm.c
++++ b/dwm.c
+_AT_@ -92,7 +92,7 @@ struct Client {
+ 	int basew, baseh, incw, inch, maxw, maxh, minw, minh, hintsvalid;
+ 	int bw, oldbw;
+ 	unsigned int tags;
+-	int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
++	int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen, resizehints;
+ 	Client *next;
+ 	Client *snext;
+ 	Monitor *mon;
+_AT_@ -139,6 +139,7 @@ typedef struct {
+ 	unsigned int tags;
+ 	int isfloating;
+ 	int monitor;
++	int resizehints;
+ } Rule;
+ 
+ /* function declarations */
+_AT_@ -299,6 +300,7 @@ applyrules(Client *c)
+ 		{
+ 			c->isfloating = r->isfloating;
+ 			c->tags |= r->tags;
++			c->resizehints = r->resizehints;
+ 			for (m = mons; m && m->num != r->monitor; m = m->next);
+ 			if (m)
+ 				c->mon = m;
+_AT_@ -343,7 +345,7 @@ applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact)
+ 		*h = bh;
+ 	if (*w < bh)
+ 		*w = bh;
+-	if (resizehints || c->isfloating || !c->mon->lt[c->mon->sellt]->arrange) {
++	if (c->resizehints || c->isfloating || !c->mon->lt[c->mon->sellt]->arrange) {
+ 		if (!c->hintsvalid)
+ 			updatesizehints(c);
+ 		/* see last two sentences in ICCCM 4.1.2.3 */
+_AT_@ -1043,6 +1045,7 @@ manage(Window w, XWindowAttributes *wa)
+ 	c->w = c->oldw = wa->width;
+ 	c->h = c->oldh = wa->height;
+ 	c->oldbw = wa->border_width;
++	c->resizehints = resizehints;
+ 
+ 	updatetitle(c);
+ 	if (XGetTransientForHint(dpy, w, &trans) && (t = wintoclient(trans))) {
+-- 
+2.46.0
+
diff --git a/dwm.suckless.org/patches/clientresizehints/index.md b/dwm.suckless.org/patches/clientresizehints/index.md
new file mode 100644
index 00000000..626abc47
--- /dev/null
+++ b/dwm.suckless.org/patches/clientresizehints/index.md
_AT_@ -0,0 +1,32 @@
+clientresizehints
+=================
+
+Description
+-----------
+`clientresizehints` allows the user to set rules about whether or not `resizehints` is applied per application.
+
+Usage Example
+-------------
+
+The following rules will cause st resizehints to be ignored, but xterm resizehints to be obeyed:
+
+    static const Rule rules[] = {
+        /* class    instance    title   tags mask       isfloating      monitor     resizehints */
+        { "St",     NULL,       NULL,   0,              0,              -1,         0 },
+        { "xterm",  NULL,       NULL,   0,              0,              -1,         1 },
+
+    };
+
+The default behavior for applications without an associated rule is to follow the global `resizehints` variable, in `config.def.h`:
+
+    static const int resizehints = 1; /* 1 means respect size hints in titled resizals */
+
+
+Download
+--------
+
+* [dwm-clientresizehints-6.5.diff](dwm-clientresizehints-6.5.diff)
+
+Author
+------
+* Fred Frey - [fred_AT_fpf3.net](mailto:fred_AT_fpf3.net)
Received on Sun Sep 22 2024 - 22:45:52 CEST
This archive was generated by hypermail 2.3.0
: Sun Sep 22 2024 - 22:48:51 CEST