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
|
diff --git a/dwm.c b/dwm.c
index 9fd0286..f1373cf 100644
--- a/dwm.c
+++ b/dwm.c
@@ -119,6 +119,7 @@ struct Monitor {
int by; /* bar geometry */
int mx, my, mw, mh; /* screen size */
int wx, wy, ww, wh; /* window area */
+ int gapp; /* gap */
unsigned int seltags;
unsigned int sellt;
unsigned int tagset[2];
@@ -210,7 +211,6 @@ static void spawn(const Arg *arg);
static void tag(const Arg *arg);
static void tagmon(const Arg *arg);
static void tile(Monitor *);
-static void togglebar(const Arg *arg);
static void togglefloating(const Arg *arg);
static void toggletag(const Arg *arg);
static void toggleview(const Arg *arg);
@@ -639,6 +639,7 @@ createmon(void)
m->nmaster = nmaster;
m->showbar = showbar;
m->topbar = topbar;
+ m->gapp = gapp;
m->lt[0] = &layouts[0];
m->lt[1] = &layouts[1 % LENGTH(layouts)];
strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
@@ -1674,40 +1675,33 @@ tagmon(const Arg *arg)
void
tile(Monitor *m)
{
- unsigned int i, n, h, mw, my, ty;
+ unsigned int i, n, h, r, mw, my, ty;
Client *c;
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
if (n == 0)
return;
-
if (n > m->nmaster)
- mw = m->nmaster ? m->ww * m->mfact : 0;
+ mw = m->nmaster ? (m->ww + m->gapp) * m->mfact : 0;
else
- mw = m->ww;
- for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
+ mw = m->ww - 2*m->gapp + m->gapp;
+ for (i = 0, my = ty = m->gapp, 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);
- if (my + HEIGHT(c) < m->wh)
- my += HEIGHT(c);
+ r = MIN(n, m->nmaster) - i;
+ h = (m->wh - my - m->gapp - m->gapp * (r - 1)) / r;
+ resize(c, m->wx + m->gapp, m->wy + my, mw - (2*c->bw) - m->gapp, h - (2*c->bw), 0);
+
+ if ((HEIGHT(c) + m->gapp) < m->wh)
+ my += HEIGHT(c) + m->gapp;
} 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);
- if (ty + HEIGHT(c) < m->wh)
- ty += HEIGHT(c);
+ r = n - i;
+ h = (m->wh - ty - m->gapp - m->gapp * (r - 1)) / r;
+ resize(c, m->wx + mw + m->gapp, m->wy + ty, m->ww - mw - (2*c->bw) - 2*m->gapp, h - (2*c->bw), 0);
+ if ((ty + HEIGHT(c) + m->gapp) < m->wh)
+ ty += HEIGHT(c) + m->gapp;
}
}
-void
-togglebar(const Arg *arg)
-{
- selmon->showbar = !selmon->showbar;
- updatebarpos(selmon);
- XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);
- arrange(selmon);
-}
-
void
togglefloating(const Arg *arg)
{
@@ -2127,6 +2121,11 @@ zoom(const Arg *arg)
pop(c);
}
+void
+autostart(void) {
+ system("~/.autostart &");
+}
+
int
main(int argc, char *argv[])
{
@@ -2145,6 +2144,7 @@ main(int argc, char *argv[])
die("pledge");
#endif /* __OpenBSD__ */
scan();
+ autostart();
run();
cleanup();
XCloseDisplay(dpy);
|