t* dwm + patches URI git clone git://git.codevoid.de/dwm-sdk DIR Log DIR Files DIR Refs DIR README DIR LICENSE --- DIR commit 0a0cd609e30d71ecf3fbddd94393b863eee28e40 DIR parent 4cdc9db81f605d9867aa7fa63d59ea9835c9dda6 URI Author: Stefan Hagen <sh+git[at]codevoid[dot]de> Date: Thu, 26 Dec 2019 14:19:40 +0100 deck-patch Diffstat: M config.def.h | 2 ++ M config.h | 10 +++++----- M dwm.c | 42 ++++++++++++++++++++++++++----- 3 files changed, 43 insertions(+), 11 deletions(-) --- DIR diff --git a/config.def.h b/config.def.h t@@ -44,6 +44,7 @@ static const Layout layouts[] = { { "[]=", tile }, /* first entry is default */ { "><>", NULL }, /* no layout function means floating behavior */ { "[M]", monocle }, + { "[D]", deck }, }; /* key definitions */ t@@ -79,6 +80,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_r, togglermaster, {0} }, DIR diff --git a/config.h b/config.h t@@ -13,11 +13,11 @@ static const char selbordercolor[] = "#990000"; // window border fg static const char warncolor[] = "#DE6D03"; // status bg warning static const char critcolor[] = "#B91807"; // status bg critical static const unsigned int borderpx = 1; // window border size px -static const unsigned int gappx = 8; // window gap size px +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 rmaster = 0; // 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@@ -59,7 +59,7 @@ static const int resizehints = 0; // 1 = respect size hints in tiles static const Layout layouts[] = { /* symbol arrange function */ - { "[T]", tile }, // first entry is default + { "[D]", deck}, // first entry is default { "[F]", NULL }, // no layout function means floating behavior }; t@@ -115,8 +115,8 @@ static Key keys[] = { { 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 } }, + { MODKEY, XK_Right, focusstack, {.i = +1 } }, + { MODKEY, XK_Left, focusstack, {.i = -1 } }, { MODKEY|ShiftMask, XK_i, incnmaster, {.i = +1 } }, { MODKEY|ShiftMask, XK_d, incnmaster, {.i = -1 } }, { MODKEY, XK_m, zoom, {0} }, DIR diff --git a/dwm.c b/dwm.c t@@ -192,6 +192,7 @@ static void configure(Client *c); static void configurenotify(XEvent *e); static void configurerequest(XEvent *e); static Monitor *createmon(void); +static void deck(Monitor *m); static void destroynotify(XEvent *e); static void detach(Client *c); static void detachstack(Client *c); t@@ -1886,23 +1887,52 @@ 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; - // 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); + // 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) + gappx , m->wy + my, mw - (2*c->bw) - gappx*(5-ns)/2, h - (2*c->bw), False); my += HEIGHT(c) + gappx; } else { h = (m->wh - ty) / (n - i) - gappx; // 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); + resize(c, (m->rmaster ? m->wx : m->wx + mw) + gappx/ns, m->wy + ty, m->ww - mw - (2*c->bw) - gappx*(5-ns)/2, h - (2*c->bw), False); ty += HEIGHT(c) + gappx; } } void +deck(Monitor *m) { + unsigned int i, n, h, mw, my, ns; + 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->rmaster ? 1.0 - m->mfact : m->mfact) + : 0; + ns = m->nmaster > 0 ? 2 : 1; + snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n - m->nmaster); + } else { + mw = m->ww; + ns = 1; + } + for(i = my = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) + if(i < m->nmaster) { + h = (m->wh - my) / (MIN(n, m->nmaster) - i); + 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); + } + else + resize(c, m->rmaster ? m->wx : m->wx + mw, m->wy, + m->ww - mw - (2*c->bw), m->wh - (2*c->bw), 0); +} + +void togglermaster(const Arg *arg) { selmon->rmaster = !selmon->rmaster;