added and fixed tilegap patch

master
Alessandro Mauri 4 years ago
parent 263464bdd1
commit c2bb0e4c6d
  1. 1
      config.h
  2. 30
      dwm.c

@ -2,6 +2,7 @@
/* appearance */
static const unsigned int borderpx = 2; /* border pixel of windows */
static const unsigned int gappx = 18; /* gaps between windows */
static const unsigned int snap = 16; /* snap pixel */
static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */

30
dwm.c

@ -809,17 +809,6 @@ drawbar(Monitor *m)
}
drw_setscheme(drw, scheme[SchemeInfoNorm]);
drw_rect(drw, x, 0, w, bh, 1, 1);
/*
if (m->sel) {
drw_setscheme(drw, scheme[m == selmon ? SchemeInfoSel : SchemeInfoNorm]);
drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
if (m->sel->isfloating)
drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
} else {
drw_setscheme(drw, scheme[SchemeInfoNorm]);
drw_rect(drw, x, 0, w, bh, 1, 1);
}
*/
}
drw_map(drw, m->barwin, 0, 0, m->ww, bh);
}
@ -1754,26 +1743,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;
ns = 1;
}
for (i = my = ty = 0, 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 + gappx, mw - (2*c->bw) - gappx * (5 - ns) / 2, h - (2*c->bw) - gappx, 0);
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);
resize(c, m->wx + mw + gappx / ns, m->wy + ty + gappx, m->ww - mw - (2*c->bw) - gappx * (5 - ns) / 2, h - (2*c->bw) - gappx * 2, 0);
ty += HEIGHT(c) + gappx;
}
}

Loading…
Cancel
Save