commit a18052689f3bc912b63e9a65e52998b0e5e756b7
parent 67101c1a40ed256fa88f052fd48a1f1f0238d713
Author: Fred Frey <fred@fpf3.net>
Date: Sun, 22 Sep 2024 16:45:44 -0400
[dwm][patch][clientresizehints] resizehints per app
Diffstat:
2 files changed, 108 insertions(+), 0 deletions(-)
diff --git a/dwm.suckless.org/patches/clientresizehints/dwm-clientresizehints-6.5.diff b/dwm.suckless.org/patches/clientresizehints/dwm-clientresizehints-6.5.diff
@@ -0,0 +1,76 @@
+From b2de13e11e7b4d67b4982ef51befa87ed9202080 Mon Sep 17 00:00:00 2001
+From: Fred Frey <fred@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
+@@ -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
+@@ -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;
+@@ -139,6 +139,7 @@ typedef struct {
+ unsigned int tags;
+ int isfloating;
+ int monitor;
++ int resizehints;
+ } Rule;
+
+ /* function declarations */
+@@ -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;
+@@ -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 */
+@@ -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
@@ -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@fpf3.net](mailto:fred@fpf3.net)