Move the monocle layout function to a separate file 🥰🥰
This commit is contained in:
parent
08ea82d301
commit
3ec665c593
3 changed files with 16 additions and 15 deletions
15
dwm.c
15
dwm.c
|
@ -1328,21 +1328,6 @@ maprequest(XEvent *e)
|
|||
manage(ev->window, &wa);
|
||||
}
|
||||
|
||||
void
|
||||
monocle(Monitor *m)
|
||||
{
|
||||
unsigned int n = 0;
|
||||
Client *c;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
void
|
||||
motionnotify(XEvent *e)
|
||||
{
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
#ifndef layouts_H
|
||||
#define layouts_H
|
||||
|
||||
// Include all layouts
|
||||
#include "tile.c"
|
||||
#include "monocle.c"
|
||||
#include "grid.c"
|
||||
#include "fibonacci.c"
|
||||
|
||||
|
|
14
layouts/monocle.c
Normal file
14
layouts/monocle.c
Normal file
|
@ -0,0 +1,14 @@
|
|||
void
|
||||
monocle(Monitor *m)
|
||||
{
|
||||
unsigned int n = 0;
|
||||
Client *c;
|
||||
|
||||
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);
|
||||
}
|
Loading…
Reference in a new issue