summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dwm.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/dwm.c b/dwm.c
index e5efb6a..50c85e7 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 *m);
-static void togglebar(const Arg *arg);
static void togglefloating(const Arg *arg);
static void toggletag(const Arg *arg);
static void toggleview(const Arg *arg);
@@ -642,6 +642,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);
@@ -1669,41 +1670,34 @@ 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)
{
if (!selmon->sel)
@@ -2122,6 +2116,11 @@ zoom(const Arg *arg)
pop(c);
}
+void
+autostart(void) {
+ system("~/.autostart &");
+}
+
int
main(int argc, char *argv[])
{
@@ -2140,6 +2139,7 @@ main(int argc, char *argv[])
die("pledge");
#endif /* __OpenBSD__ */
scan();
+ autostart();
run();
cleanup();
XCloseDisplay(dpy);