1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
# 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
|