t* dwm + patches
       
   URI git clone git://git.codevoid.de/dwm-sdk
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit 4cdc9db81f605d9867aa7fa63d59ea9835c9dda6
   DIR parent ad34abd2bd143529ce05dee82f9f5a1ed47a4fb7
   URI Author: Stefan Hagen <sh+git[at]codevoid[dot]de>
       Date:   Thu, 26 Dec 2019 13:34:27 +0100
       
       add rmaster
       
       Diffstat:
         M config.def.h                        |       2 ++
         M config.h                            |       2 ++
         M dwm.c                               |      27 ++++++++++++++++++++++++---
       
       3 files changed, 28 insertions(+), 3 deletions(-)
       ---
   DIR diff --git a/config.def.h b/config.def.h
       t@@ -3,6 +3,7 @@
        /* appearance */
        static const unsigned int borderpx  = 1;        /* border pixel of windows */
        static const unsigned int snap      = 32;       /* snap pixel */
       +static const int rmaster            = 1;        /* 1 means master-area is initially on the right */
        static const int showbar            = 1;        /* 0 means no bar */
        static const int topbar             = 1;        /* 0 means bottom bar */
        static const char statussep         = ';';      /* separator between status bars */
       t@@ -80,6 +81,7 @@ static Key keys[] = {
                { MODKEY,                       XK_m,      setlayout,      {.v = &layouts[2]} },
                { MODKEY,                       XK_space,  setlayout,      {0} },
                { MODKEY|ShiftMask,             XK_space,  togglefloating, {0} },
       +        { MODKEY,                       XK_r,      togglermaster,  {0} },
                { MODKEY,                       XK_0,      view,           {.ui = ~0 } },
                { MODKEY|ShiftMask,             XK_0,      tag,            {.ui = ~0 } },
                { MODKEY,                       XK_comma,  focusmon,       {.i = -1 } },
   DIR diff --git a/config.h b/config.h
       t@@ -17,6 +17,7 @@ static const unsigned int gappx          = 8;        // window gap size px
        static const unsigned int snap           = 8;         // snap distance px
        static const unsigned int systrayspacing = 1;         // systray spacing
        static const unsigned int systraypinning = 1;         // 0 tray follows mouse
       +static const int rmaster                 = 1;        // 1 means master-area is on the right
        static const int systraypinningfailfirst = 1;         // 1 first screen, 0 last
        static const int showsystray             = 1;         // 0 = no systray
        static const int showbar                 = 1;         // 0 = no bar
       t@@ -112,6 +113,7 @@ static Key keys[] = {
            { MODKEY|ShiftMask,    XK_o,       spawn,          {.v = notescmd } },
            { MODKEY|ShiftMask,    XK_t,       spawn,          {.v = timer } },
            { MODKEY,              XK_minus,   togglescratch,  {.v = scratchpadcmd } },
       +        { MODKEY|ShiftMask,    XK_r,       togglermaster,  {0} },
            { MODKEY,              XK_b,       togglebar,      {0} },
            { MODKEY,              XK_Down,    focusstack,     {.i = +1 } },
            { MODKEY,              XK_Up,      focusstack,     {.i = -1 } },
   DIR diff --git a/dwm.c b/dwm.c
       t@@ -141,6 +141,7 @@ struct Monitor {
            unsigned int seltags;
            unsigned int sellt;
            unsigned int tagset[2];
       +        int rmaster;
            int showbar;
            int topbar;
            Client *clients;
       t@@ -251,6 +252,7 @@ static void tagmon(const Arg *arg);
        static void tile(Monitor *);
        static void togglebar(const Arg *arg);
        static void togglefloating(const Arg *arg);
       +static void togglermaster(const Arg *arg);
        static void togglescratch(const Arg *arg);
        static void toggletag(const Arg *arg);
        static void toggleview(const Arg *arg);
       t@@ -736,6 +738,7 @@ Monitor * createmon(void)
            m->tagset[0] = m->tagset[1] = 1;
            m->mfact = mfact;
            m->nmaster = nmaster;
       +        m->rmaster = rmaster;
            m->showbar = showbar;
            m->topbar = topbar;
            m->lt[0] = &layouts[0];
       t@@ -1872,7 +1875,9 @@ void tile(Monitor *m) {
                return;
        
            if (n > m->nmaster) {
       -        mw = m->nmaster ? m->ww * m->mfact : 0;
       +                mw = m->nmaster
       +                        ? m->ww * (m->rmaster ? 1.0 - m->mfact : m->mfact)
       +                        : 0;
                ns = m->nmaster > 0 ? 2 : 1;
            } else {
                mw = m->ww;
       t@@ -1881,16 +1886,32 @@ void tile(Monitor *m) {
            for(i = 0, my = ty = gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
                if(i < m->nmaster) {
                    h = (m->wh - my) / (MIN(n, m->nmaster) - i) - gappx;
       -            resize(c, m->wx + gappx, m->wy + my, mw - (2*c->bw) - gappx*(5-ns)/2, h - (2*c->bw), False);
       +            // gaps: resize(c, m->wx + gappx, m->wy + my, mw - (2*c->bw) - gappx*(5-ns)/2, h - (2*c->bw), False);
       +            // orig: resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0);
       +                        resize(c, m->rmaster ? m->wx + m->ww - mw : m->wx,
       +                               m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0);
                    my += HEIGHT(c) + gappx;
                }
                else {
                    h = (m->wh - ty) / (n - i) - gappx;
       -            resize(c, m->wx + mw + gappx/ns, m->wy + ty, m->ww - mw - (2*c->bw) - gappx*(5-ns)/2, h - (2*c->bw), False);
       +            // gaps: resize(c, m->wx + mw + gappx/ns, m->wy + ty, m->ww - mw - (2*c->bw) - gappx*(5-ns)/2, h - (2*c->bw), False);
       +                        // orig: resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0);
       +                        resize(c, m->rmaster ? m->wx : m->wx + mw, m->wy + ty,
       +                               m->ww - mw - (2*c->bw), h - (2*c->bw), 0);
                    ty += HEIGHT(c) + gappx;
                }
        }
        
       +void
       +togglermaster(const Arg *arg)
       +{
       +        selmon->rmaster = !selmon->rmaster;
       +        /* now mfact represents the left factor */
       +        selmon->mfact = 1.0 - selmon->mfact;
       +        if (selmon->lt[selmon->sellt]->arrange)
       +                arrange(selmon);
       +}
       +
        void togglebar(const Arg *arg)
        {
            selmon->showbar = !selmon->showbar;