This commit is contained in:
Cadey Ratio 2020-05-31 09:01:43 -04:00
parent 9a39d34100
commit f10415f592
2 changed files with 30 additions and 1 deletions

View File

@ -56,10 +56,11 @@ static const Layout layouts[] = {
{ "[M]", monocle }, { "[M]", monocle },
{ "|M|", centeredmaster }, { "|M|", centeredmaster },
{ ">M>", centeredfloatingmaster }, { ">M>", centeredfloatingmaster },
{ "|||", col },
}; };
/* key definitions */ /* key definitions */
#define MODKEY Mod1Mask #define MODKEY Mod4Mask
#define TAGKEYS(KEY,TAG) \ #define TAGKEYS(KEY,TAG) \
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \ { MODKEY, KEY, view, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \ { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
@ -93,6 +94,7 @@ static Key keys[] = {
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, { MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
{ MODKEY, XK_u, setlayout, {.v = &layouts[3]} }, { MODKEY, XK_u, setlayout, {.v = &layouts[3]} },
{ MODKEY, XK_o, setlayout, {.v = &layouts[4]} }, { MODKEY, XK_o, setlayout, {.v = &layouts[4]} },
{ MODKEY, XK_c, setlayout, {.v = &layouts[5]} },
{ MODKEY, XK_space, setlayout, {0} }, { MODKEY, XK_space, setlayout, {0} },
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} }, { MODKEY|ShiftMask, XK_space, togglefloating, {0} },
{ MODKEY, XK_0, view, {.ui = ~0 } }, { MODKEY, XK_0, view, {.ui = ~0 } },

27
dwm.c
View File

@ -244,6 +244,7 @@ static void spawn(const Arg *arg);
static Monitor *systraytomon(Monitor *m); static Monitor *systraytomon(Monitor *m);
static void tag(const Arg *arg); static void tag(const Arg *arg);
static void tagmon(const Arg *arg); static void tagmon(const Arg *arg);
static void col(Monitor *);
static void tile(Monitor *); static void tile(Monitor *);
static void togglebar(const Arg *arg); static void togglebar(const Arg *arg);
static void togglefloating(const Arg *arg); static void togglefloating(const Arg *arg);
@ -1963,6 +1964,32 @@ tagmon(const Arg *arg)
sendmon(selmon->sel, dirtomon(arg->i)); sendmon(selmon->sel, dirtomon(arg->i));
} }
void
col(Monitor *m) {
unsigned int i, n, h, w, x, y,mw;
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;
else
mw = m->ww;
for(i = x = y = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) {
if(i < m->nmaster) {
w = (mw - x) / (MIN(n, m->nmaster)-i);
resize(c, x + m->wx, m->wy, w - (2*c->bw), m->wh - (2*c->bw), False);
x += WIDTH(c);
}
else {
h = (m->wh - y) / (n - i);
resize(c, x + m->wx, m->wy + y, m->ww - x - (2*c->bw), h - (2*c->bw), False);
y += HEIGHT(c);
}
}
}
void void
tile(Monitor *m) tile(Monitor *m)
{ {