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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
diff --git a/config.def.h b/config.def.h
index 1c0b587..bc1a869 100644
--- a/config.def.h
+++ b/config.def.h
@@ -1,7 +1,8 @@
/* See LICENSE file for copyright and license details. */
/* appearance */
-static const unsigned int borderpx = 1; /* border pixel of windows */
+static const unsigned int borderpx = 2; /* border pixel of windows */
+static const unsigned int gappx = 20; /* gap pixel between windows */
static const unsigned int snap = 32; /* snap pixel */
static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */
@@ -32,7 +33,7 @@ static const Rule rules[] = {
};
/* layout(s) */
-static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
+static const float mfact = 0.50; /* factor of master area size [0.05..0.95] */
static const int nmaster = 1; /* number of clients in master area */
static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
diff --git a/dwm.c b/dwm.c
index 4465af1..dc953c0 100644
--- a/dwm.c
+++ b/dwm.c
@@ -783,6 +783,7 @@ expose(XEvent *e)
void
focus(Client *c)
{
+ XWindowChanges wc;
if (!c || !ISVISIBLE(c))
for (c = selmon->stack; c && !ISVISIBLE(c); c = c->snext);
if (selmon->sel && selmon->sel != c)
@@ -795,6 +796,9 @@ focus(Client *c)
detachstack(c);
attachstack(c);
grabbuttons(c, 1);
+ c->bw = borderpx;
+ wc.border_width = c->bw;
+ XConfigureWindow(dpy, c->win, CWBorderWidth, &wc);
XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel);
setfocus(c);
} else {
@@ -1047,7 +1051,7 @@ manage(Window w, XWindowAttributes *wa)
/* only fix client y-offset, if the client center might cover the bar */
c->y = MAX(c->y, ((c->mon->by == c->mon->my) && (c->x + (c->w / 2) >= c->mon->wx)
&& (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my);
- c->bw = borderpx;
+ c->bw = 0; // borderpx
wc.border_width = c->bw;
XConfigureWindow(dpy, w, CWBorderWidth, &wc);
@@ -1673,26 +1677,29 @@ tagmon(const Arg *arg)
void
tile(Monitor *m)
{
- unsigned int i, n, h, mw, my, ty;
+ unsigned int i, n, h, mw, my, ty, ns;
Client *c;
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
if (n == 0)
return;
- if (n > m->nmaster)
+ if (n > m->nmaster) {
mw = m->nmaster ? m->ww * m->mfact : 0;
- else
+ ns = m->nmaster > 0 ? 2 : 1;
+ } else {
mw = m->ww;
- for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
+ ns = 1;
+ }
+ for(i = 0, my = ty = gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
if (i < m->nmaster) {
- h = (m->wh - my) / (MIN(n, m->nmaster) - i);
- resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0);
- my += HEIGHT(c);
+ h = (m->wh - my) / (MIN(n, m->nmaster) - i) - gappx;
+ resize(c, m->wx + gappx, m->wy + my, mw - (2*c->bw) - gappx*(5-ns)/2, h - (2*c->bw), False);
+ my += HEIGHT(c) + gappx;
} else {
- h = (m->wh - ty) / (n - i);
- resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0);
- ty += HEIGHT(c);
+ h = (m->wh - ty) / (n - i) - gappx;
+ resize(c, m->wx + mw + gappx/ns, m->wy + ty, m->ww - mw - (2*c->bw) - gappx*(5-ns)/2, h - (2*c->bw), False);
+ ty += HEIGHT(c) + gappx;
}
}
@@ -1749,9 +1756,13 @@ toggleview(const Arg *arg)
void
unfocus(Client *c, int setfocus)
{
+ XWindowChanges wc;
if (!c)
return;
grabbuttons(c, 0);
+ c->bw = 0; // borderpx
+ wc.border_width = c->bw;
+ XConfigureWindow(dpy, c->win, CWBorderWidth, &wc);
XSetWindowBorder(dpy, c->win, scheme[SchemeNorm][ColBorder].pixel);
if (setfocus) {
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
|