diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2023-11-06 00:32:24 +0000 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2023-11-06 00:32:24 +0000 |
commit | dde321282059f2d8bb79667267207edd012f6d8a (patch) | |
tree | 98e4703a7403d1f094ea86e9a9a5f0f9ec327d26 /dwm.c | |
parent | 13190da417cd3a7d20c5da8d36664990c56adebd (diff) | |
download | dwm-dde321282059f2d8bb79667267207edd012f6d8a.tar.gz dwm-dde321282059f2d8bb79667267207edd012f6d8a.tar.bz2 dwm-dde321282059f2d8bb79667267207edd012f6d8a.zip |
Added "deck" layout patch
Diffstat (limited to 'dwm.c')
-rw-r--r-- | dwm.c | 29 |
1 files changed, 29 insertions, 0 deletions
@@ -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); @@ -745,6 +746,34 @@ destroynotify(XEvent *e) } 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) { Client **tc; |