From dde321282059f2d8bb79667267207edd012f6d8a Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Mon, 6 Nov 2023 00:32:24 +0000 Subject: Added "deck" layout patch --- dwm.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'dwm.c') diff --git a/dwm.c b/dwm.c index 84a5040..9d2f368 100644 --- a/dwm.c +++ b/dwm.c @@ -164,6 +164,7 @@ static void configurenotify(XEvent *e); static void configurerequest(XEvent *e); static void copyvalidchars(char *text, char *rawtext); static Monitor *createmon(void); +static void deck(Monitor *m); static void destroynotify(XEvent *e); static void detach(Client *c); static void detachstack(Client *c); @@ -744,6 +745,34 @@ destroynotify(XEvent *e) unmanage(c, 1); } +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->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 = 0, my = 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); + if (my + HEIGHT(c) < m->wh) + my += HEIGHT(c) + m->gappx; + } + else + resize(c, m->wx + mw + gappx/ns, m->wy + gappx, m->ww - mw - (2*c->bw) - gappx*(5-ns)/2, m->wh - (2*c->bw) - 2*gappx, False); +} + void detach(Client *c) { -- cgit v1.2.3-13-gbd6f