dwm-gaps-6.0.diff - sites - public wiki contents of suckless.org
(HTM) git clone git://git.suckless.org/sites
(DIR) Log
(DIR) Files
(DIR) Refs
---
dwm-gaps-6.0.diff (1896B)
---
1 diff --git a/config.def.h b/config.def.h
2 index 77ff358..a4e496b 100644
3 --- a/config.def.h
4 +++ b/config.def.h
5 @@ -9,6 +9,7 @@ static const char selbordercolor[] = "#005577";
6 static const char selbgcolor[] = "#005577";
7 static const char selfgcolor[] = "#eeeeee";
8 static const unsigned int borderpx = 1; /* border pixel of windows */
9 +static const unsigned int gappx = 1; /* gap pixel between windows */
10 static const unsigned int snap = 32; /* snap pixel */
11 static const Bool showbar = True; /* False means no bar */
12 static const Bool topbar = True; /* False means bottom bar */
13 diff --git a/dwm.c b/dwm.c
14 index 1d78655..6cc96ff 100644
15 --- a/dwm.c
16 +++ b/dwm.c
17 @@ -1703,7 +1703,7 @@ textnw(const char *text, unsigned int len) {
18
19 void
20 tile(Monitor *m) {
21 - unsigned int i, n, h, mw, my, ty;
22 + unsigned int i, n, h, r, g = 0, mw, my, ty;
23 Client *c;
24
25 for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
26 @@ -1711,19 +1711,21 @@ tile(Monitor *m) {
27 return;
28
29 if(n > m->nmaster)
30 - mw = m->nmaster ? m->ww * m->mfact : 0;
31 + mw = m->nmaster ? (m->ww - (g = gappx)) * m->mfact : 0;
32 else
33 mw = m->ww;
34 for(i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
35 if(i < m->nmaster) {
36 - h = (m->wh - my) / (MIN(n, m->nmaster) - i);
37 + r = MIN(n, m->nmaster) - i;
38 + h = (m->wh - my - gappx * (r - 1)) / r;
39 resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), False);
40 - my += HEIGHT(c);
41 + my += HEIGHT(c) + gappx;
42 }
43 else {
44 - h = (m->wh - ty) / (n - i);
45 - resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), False);
46 - ty += HEIGHT(c);
47 + r = n - i;
48 + h = (m->wh - ty - gappx * (r - 1)) / r;
49 + resize(c, m->wx + mw + g, m->wy + ty, m->ww - mw - g - (2*c->bw), h - (2*c->bw), False);
50 + ty += HEIGHT(c) + gappx;
51 }
52 }
53