Added gaps in monocle mode
This commit is contained in:
parent
78f68cecc3
commit
3b5454254c
37
dwm.c
37
dwm.c
|
|
@ -1111,18 +1111,47 @@ maprequest(XEvent *e)
|
|||
void
|
||||
monocle(Monitor *m)
|
||||
{
|
||||
unsigned int n = 0;
|
||||
unsigned int n = 0, oe = enablegaps;
|
||||
Client *c;
|
||||
|
||||
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
||||
if (n == 0)
|
||||
return;
|
||||
|
||||
if (smartgaps == n) {
|
||||
oe = 0; // outer gaps disabled
|
||||
}
|
||||
|
||||
n = 0;
|
||||
|
||||
for (c = m->clients; c; c = c->next)
|
||||
if (ISVISIBLE(c))
|
||||
n++;
|
||||
if (n > 0) /* override layout symbol */
|
||||
snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n);
|
||||
for (c = nexttiled(m->clients); c; c = nexttiled(c->next))
|
||||
resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
|
||||
}
|
||||
int newx, newy, neww, newh;
|
||||
|
||||
for (c = nexttiled(m->clients); c; c = nexttiled(c->next)) {
|
||||
if (m->gappoh == 0) {
|
||||
newx = m->wx - c->bw;
|
||||
newy = m->wy - c->bw;
|
||||
neww = m->ww;
|
||||
newh = m->wh;
|
||||
} else {
|
||||
newx = m->wx + m->gappoh*oe - c->bw;
|
||||
newy = m->wy + m->gappoh*oe - c->bw;
|
||||
neww = m->ww - 2 * (m->gappoh*oe + c->bw);
|
||||
newh = m->wh - 2 * (m->gappoh*oe + c->bw);
|
||||
}
|
||||
applysizehints(c, &newx, &newy, &neww, &newh, 0);
|
||||
if (neww < m->ww)
|
||||
newx = m->wx + (m->ww - (neww + 2 * c->bw)) / 2;
|
||||
if (newh < m->wh)
|
||||
newy = m->wy + (m->wh - (newh + 2 * c->bw)) / 2;
|
||||
resize(c, newx, newy, neww, newh, 0);
|
||||
}
|
||||
|
||||
}
|
||||
void
|
||||
motionnotify(XEvent *e)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user