columns - dwm - dynamic window manager
 (HTM) git clone https://git.parazyd.org/dwm
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 981ba3e87611cd5d2bd1673b20fcd0bcf2ee9553
 (DIR) parent e250e8dce3c926caaacf1555ef4763aee3eb8109
 (HTM) Author: parazyd <parazyd@dyne.org>
       Date:   Sun, 24 Apr 2022 00:19:07 +0200
       
       columns
       
       Diffstat:
         M config.def.h                        |       2 ++
         M config.h                            |       2 ++
         M dwm.c                               |      27 +++++++++++++++++++++++++++
       
       3 files changed, 31 insertions(+), 0 deletions(-)
       ---
 (DIR) diff --git a/config.def.h b/config.def.h
       @@ -47,6 +47,7 @@ static const Layout layouts[] = {
                { "[]=",      tile },    /* first entry is default */
                { "><>",      NULL },    /* no layout function means floating behavior */
                { "[M]",      monocle },
       +        { "|||",      col },
        };
        
        /* key definitions */
       @@ -85,6 +86,7 @@ static const Key keys[] = {
                { MODKEY,                       XK_t,      setlayout,      {.v = &layouts[0]} },
                { MODKEY,                       XK_f,      setlayout,      {.v = &layouts[1]} },
                { MODKEY,                       XK_m,      setlayout,      {.v = &layouts[2]} },
       +        { MODKEY,                       XK_c,      setlayout,      {.v = &layouts[3]} },
                { MODKEY,                       XK_space,  setlayout,      {0} },
                { MODKEY|ShiftMask,             XK_space,  togglefloating, {0} },
                { MODKEY,                       XK_0,      view,           {.ui = ~0 } },
 (DIR) diff --git a/config.h b/config.h
       @@ -48,6 +48,7 @@ static const Layout layouts[] = {
                { "[t]",      tile },    /* first entry is default */
                { "[f]",      NULL },    /* no layout function means floating behavior */
                { "[m]",      monocle },
       +        { "|||",      col },
        };
        
        /* key definitions */
       @@ -86,6 +87,7 @@ static Key keys[] = {
                { MODKEY,                       XK_t,      setlayout,      {.v = &layouts[0]} },
                { MODKEY,                       XK_f,      setlayout,      {.v = &layouts[1]} },
                { MODKEY,                       XK_m,      setlayout,      {.v = &layouts[2]} },
       +        { MODKEY,                       XK_c,      setlayout,      {.v = &layouts[3]} },
                { MODKEY,                       XK_space,  setlayout,      {0} },
                { MODKEY|ShiftMask,             XK_space,  togglefloating, {0} },
                // { MODKEY,                       XK_0,      view,           {.ui = ~0 } },
 (DIR) diff --git a/dwm.c b/dwm.c
       @@ -176,6 +176,7 @@ static void checkotherwm(void);
        static void cleanup(void);
        static void cleanupmon(Monitor *mon);
        static void clientmessage(XEvent *e);
       +static void col(Monitor *);
        static void configure(Client *c);
        static void configurenotify(XEvent *e);
        static void configurerequest(XEvent *e);
       @@ -1955,6 +1956,32 @@ tagmon(const Arg *arg)
        }
        
        void
       +col(Monitor *m)
       +{
       +        unsigned int i, n, h, w, x, y, mw;
       +        Client *c;
       +
       +        for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
       +        if (n == 0)
       +                return;
       +
       +        if (n > m->nmaster)
       +                mw = m->nmaster ? m->ww * m->mfact : 0;
       +        else
       +                mw = m->ww;
       +        for (i = x = y = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
       +                if (i < m->nmaster) {
       +                        w = (mw - x) / (MIN(n, m->nmaster) - i);
       +                        resize(c, x + m->wx, m->wy, w - (2 * c->bw), m->wh - (2 * c->bw), 0);
       +                        x += WIDTH(c);
       +                } else {
       +                        h = (m->wh - y) / (n - i);
       +                        resize(c, x + m->wx, m->wy + y, m->ww - x - (2 * c->bw), h - (2 * c->bw), 0);
       +                        y += HEIGHT(c);
       +                }
       +}
       +
       +void
        tile(Monitor *m)
        {
                unsigned int i, n, h, mw, my, ty;