dwm-sizehints-isfreesize-6.2.diff - sites - public wiki contents of suckless.org | |
git clone git://git.suckless.org/sites | |
Log | |
Files | |
Refs | |
--- | |
dwm-sizehints-isfreesize-6.2.diff (3275B) | |
--- | |
1 From 5d4e92801206d47090236498d35f199e46dd07f6 Mon Sep 17 00:00:00 2001 | |
2 From: MLquest8 <[email protected]> | |
3 Date: Sat, 20 Jun 2020 15:40:43 +0400 | |
4 Subject: [PATCH] sizehints-ruled now with a separate rule "isfreesize" a… | |
5 cleaner code. | |
6 | |
7 --- | |
8 config.def.h | 8 +++++--- | |
9 dwm.c | 16 +++++++++++++--- | |
10 2 files changed, 18 insertions(+), 6 deletions(-) | |
11 | |
12 diff --git a/config.def.h b/config.def.h | |
13 index 1c0b587..0e4a5ea 100644 | |
14 --- a/config.def.h | |
15 +++ b/config.def.h | |
16 @@ -26,9 +26,11 @@ static const Rule rules[] = { | |
17 * WM_CLASS(STRING) = instance, class | |
18 * WM_NAME(STRING) = title | |
19 */ | |
20 - /* class instance title tags mask isfloating … | |
21 - { "Gimp", NULL, NULL, 0, 1, … | |
22 - { "Firefox", NULL, NULL, 1 << 8, 0, … | |
23 + /* class instance title tags mask isfloating … | |
24 + { "Gimp", NULL, NULL, 0, 1, … | |
25 + { "Firefox", NULL, NULL, 1 << 8, 0, … | |
26 + { "st", NULL, NULL, 0, 0, … | |
27 + { "St", NULL, NULL, 0, 0, … | |
28 }; | |
29 | |
30 /* layout(s) */ | |
31 diff --git a/dwm.c b/dwm.c | |
32 index 9fd0286..73825d1 100644 | |
33 --- a/dwm.c | |
34 +++ b/dwm.c | |
35 @@ -92,7 +92,7 @@ struct Client { | |
36 int basew, baseh, incw, inch, maxw, maxh, minw, minh; | |
37 int bw, oldbw; | |
38 unsigned int tags; | |
39 - int isfixed, isfloating, isurgent, neverfocus, oldstate, isfull… | |
40 + int isfixed, isfloating, isfreesize, isurgent, neverfocus, olds… | |
41 Client *next; | |
42 Client *snext; | |
43 Monitor *mon; | |
44 @@ -138,6 +138,7 @@ typedef struct { | |
45 const char *title; | |
46 unsigned int tags; | |
47 int isfloating; | |
48 + int isfreesize; | |
49 int monitor; | |
50 } Rule; | |
51 | |
52 @@ -287,6 +288,7 @@ applyrules(Client *c) | |
53 | |
54 /* rule matching */ | |
55 c->isfloating = 0; | |
56 + c->isfreesize = 1; | |
57 c->tags = 0; | |
58 XGetClassHint(dpy, c->win, &ch); | |
59 class = ch.res_class ? ch.res_class : broken; | |
60 @@ -299,6 +301,7 @@ applyrules(Client *c) | |
61 && (!r->instance || strstr(instance, r->instance))) | |
62 { | |
63 c->isfloating = r->isfloating; | |
64 + c->isfreesize = r->isfreesize; | |
65 c->tags |= r->tags; | |
66 for (m = mons; m && m->num != r->monitor; m = m… | |
67 if (m) | |
68 @@ -1952,7 +1955,7 @@ updatesizehints(Client *c) | |
69 | |
70 if (!XGetWMNormalHints(dpy, c->win, &size, &msize)) | |
71 /* size is uninitialized, ensure that size.flags aren't… | |
72 - size.flags = PSize; | |
73 + size.flags = 0; | |
74 if (size.flags & PBaseSize) { | |
75 c->basew = size.base_width; | |
76 c->baseh = size.base_height; | |
77 @@ -1984,6 +1987,11 @@ updatesizehints(Client *c) | |
78 c->maxa = (float)size.max_aspect.x / size.max_aspect.y; | |
79 } else | |
80 c->maxa = c->mina = 0.0; | |
81 + if((size.flags & PSize) && c->isfreesize) { | |
82 + c->basew = size.base_width; | |
83 + c->baseh = size.base_height; | |
84 + c->isfloating = 1; | |
85 + } | |
86 c->isfixed = (c->maxw && c->maxh && c->maxw == c->minw && c->ma… | |
87 } | |
88 | |
89 @@ -2012,8 +2020,10 @@ updatewindowtype(Client *c) | |
90 | |
91 if (state == netatom[NetWMFullscreen]) | |
92 setfullscreen(c, 1); | |
93 - if (wtype == netatom[NetWMWindowTypeDialog]) | |
94 + if (wtype == netatom[NetWMWindowTypeDialog]) { | |
95 c->isfloating = 1; | |
96 + c->isfreesize = 1; | |
97 + } | |
98 } | |
99 | |
100 void | |
101 -- | |
102 2.26.2 | |
103 |