vanitygaps: add monocle layout with gaps - dwm - 🖥 my version of dwm (frankenstein's monster)
 (HTM) git clone https://git.drkhsh.at/dwm.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit fe47c9d6d7d3ef5310be2fbd9f62d0dd2c5575f2
 (DIR) parent c48137303e5fe3096563f59c5c80847a8aeeeb3f
 (HTM) Author: drkhsh <me@drkhsh.at>
       Date:   Tue, 20 Dec 2022 02:30:11 +0100
       
       vanitygaps: add monocle layout with gaps
       
       Diffstat:
         M dwm.c                               |      15 ---------------
         M vanitygaps.c                        |      23 +++++++++++++++++++++++
       
       2 files changed, 23 insertions(+), 15 deletions(-)
       ---
 (DIR) diff --git a/dwm.c b/dwm.c
       @@ -1186,21 +1186,6 @@ maprequest(XEvent *e)
        }
        
        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)
        {
                static Monitor *mon = NULL;
 (DIR) diff --git a/vanitygaps.c b/vanitygaps.c
       @@ -771,6 +771,29 @@ nrowgrid(Monitor *m)
        }
        
        /*
       + * Default monocle layout + gaps
       + */
       +void
       +monocle(Monitor *m)
       +{
       +        unsigned int n = 0;
       +        int oh, ov, ih, iv;
       +        Client *c;
       +
       +        getgaps(m, &oh, &ov, &ih, &iv, &n);
       +        if (n == 0)
       +                return;
       +
       +        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 / 2);
       +        for (c = nexttiled(m->clients); c; c = nexttiled(c->next))
       +                resize(c, m->wx + oh, m->wy + ov, m->ww - 2 * oh - 2 * c->bw, m->wh - 2 * ov - 2 * c->bw, 0);
       +}
       +
       +/*
         * Default tile layout + gaps
         */
        static void