dwm

[fork] dynamic window manager
Log | Files | Refs | README | LICENSE

commit 822ce075af4dfce5f198ee3b72c6d14a452c6ae9
parent 8fe463c5f5596354daae374c6ae13c82eef4a5f7
Author: Hayden Hamilton <haydenh@sdf.org>
Date:   Sat, 13 Jun 2020 21:57:32 +0100

email

Diffstat:
MLICENSE | 2+-
Aconfig.def.h | 0
Mconfig.h | 2++
Mdwm.c | 27+++++++++++++++++++++++++++
4 files changed, 30 insertions(+), 1 deletion(-)

diff --git a/LICENSE b/LICENSE @@ -17,7 +17,7 @@ MIT/X Consortium License © 2015-2016 Quentin Rameau <quinq@fifth.space> © 2015-2016 Eric Pruitt <eric.pruitt@gmail.com> © 2016-2017 Markus Teich <markus.teich@stusta.mhn.de> -(C) 2019-Present - Forked by Hayden Hamilton <hayden@haydenvh.com> +(C) 2019-Present - Forked by Hayden Hamilton <haydenh@sdf.org> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), diff --git a/config.def.h b/config.def.h diff --git a/config.h b/config.h @@ -41,6 +41,7 @@ static const Layout layouts[] = { { "[#=-]", dwindle }, { "[SMS]", centeredmaster }, { "[\\M/]", centeredfloatingmaster }, + { "[╦]", portrait }, }; /* key definitions */ @@ -86,6 +87,7 @@ static Key keys[] = { { MODKEY|AltMask, XK_4, setlayout, {.v = &layouts[4]} }, { MODKEY|AltMask, XK_5, setlayout, {.v = &layouts[5]} }, { MODKEY|AltMask, XK_6, setlayout, {.v = &layouts[6]} }, + { MODKEY|AltMask, XK_7, setlayout, {.v = &layouts[7]} }, { MODKEY|AltMask, XK_0, setlayout, {.v = &layouts[2]} }, /* Tags */ TAGKEYS( XK_1, 0) diff --git a/dwm.c b/dwm.c @@ -219,6 +219,7 @@ static void spawn(const Arg *arg); static void tag(const Arg *arg); static void tagmon(const Arg *arg); static void tile(Monitor *); +static void portrait(Monitor *); //static void togglebar(const Arg *arg); static void togglefloating(const Arg *arg); static void togglefullscr(const Arg *arg); @@ -1681,6 +1682,32 @@ tile(Monitor *m) } void +portrait(Monitor *m) +{ + unsigned int i, n, h, mw, my, ty; + 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->wh * m->mfact : 0; + else + mw = m->wh - m->gappx; + for (i = 0, my = ty = m->gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) + if (i < m->nmaster) { + h = (m->wh - my) / (MIN(n, m->nmaster) - i) - m->gappx; + resize(c, m->wx + m->gappx, m->wy + my, mw - (2*c->bw) - m->gappx, h - (2*c->bw), 0); + my += HEIGHT(c) + m->gappx; + } else { + h = (m->wh - ty) / (n - i) - m->gappx; + resize(c, m->wx + mw + m->gappx, m->wy + ty, m->ww - mw - (2*c->bw) - (2*m->gappx), h - (2*c->bw), 0); + ty += HEIGHT(c) + m->gappx; + } +} + +void togglefloating(const Arg *arg) { if (!selmon->sel)