commit 4ca959d9b9c103e9c2c018d98af3e944ad39a404
parent f96422b9d1162a909cf1f4eca30ecc01c08596c2
Author: Jake Koroman <jakekoroman@gmail.com>
Date: Mon, 5 Aug 2024 19:23:31 -0400
added deck patch.
Diffstat:
3 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/README b/README
@@ -7,6 +7,7 @@ Patches Applied
---------------
alwayscenter - https://dwm.suckless.org/patches/alwayscenter/
bartabgroups - https://dwm.suckless.org/patches/bartabgroups/
+deck - https://dwm.suckless.org/patches/deck/
movestack - https://dwm.suckless.org/patches/movestack/
swallow - https://dwm.suckless.org/patches/swallow/
diff --git a/config.def.h b/config.def.h
@@ -56,6 +56,7 @@ static const Layout layouts[] = {
{ "[]=", tile }, /* first entry is default */
{ "><>", NULL }, /* no layout function means floating behavior */
{ "[M]", monocle },
+ { "[D]", deck },
};
/* key definitions */
@@ -93,6 +94,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_y, setlayout, {.v = &layouts[3]} },
{ MODKEY, XK_space, setlayout, {0} },
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
{ MODKEY, XK_0, view, {.ui = ~0 } },
diff --git a/dwm.c b/dwm.c
@@ -167,6 +167,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);
@@ -818,6 +819,31 @@ destroynotify(XEvent *e)
}
void
+deck(Monitor *m) {
+ unsigned int i, n, h, mw, my;
+ 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;
+ snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n - m->nmaster);
+ }
+ else
+ mw = m->ww;
+ 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->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), False);
+ my += HEIGHT(c);
+ }
+ else
+ resize(c, m->wx + mw, m->wy, m->ww - mw - (2*c->bw), m->wh - (2*c->bw), False);
+}
+
+void
detach(Client *c)
{
Client **tc;