Move the monocle layout function to a separate file 🥰🥰

This commit is contained in:
Anas Elgarhy 2022-07-10 20:54:48 +02:00
parent 08ea82d301
commit 3ec665c593
3 changed files with 16 additions and 15 deletions

15
dwm.c
View file

@ -1328,21 +1328,6 @@ maprequest(XEvent *e)
manage(ev->window, &wa); 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 void
motionnotify(XEvent *e) motionnotify(XEvent *e)
{ {

View file

@ -1,7 +1,9 @@
#ifndef layouts_H #ifndef layouts_H
#define layouts_H #define layouts_H
// Include all layouts
#include "tile.c" #include "tile.c"
#include "monocle.c"
#include "grid.c" #include "grid.c"
#include "fibonacci.c" #include "fibonacci.c"

14
layouts/monocle.c Normal file
View 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);
}