Merge branch 'deck' into patched

This commit is contained in:
GasparVardanyan 2024-10-01 05:40:41 +04:00
commit 10e5b926d3
2 changed files with 28 additions and 0 deletions

View file

@ -62,6 +62,7 @@ static const Layout layouts[] = {
{ "><>", NULL }, /* no layout function means floating behavior */
{ "[M]", monocle },
{ "[S]", stairs },
{ "[D]", deck },
};
/* key definitions */
@ -130,6 +131,7 @@ static const Key keys[] = {
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
{ MODKEY, XK_s, setlayout, {.v = &layouts[3]} },
{ MODKEY, XK_r, setlayout, {.v = &layouts[4]} },
{ MODKEY, XK_space, setlayout, {0} },
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
{ MODKEY|ShiftMask, XK_f, togglefullscr, {0} },

26
dwm.c
View file

@ -162,6 +162,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);
@ -710,6 +711,31 @@ destroynotify(XEvent *e)
unmanage(c, 1);
}
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)
{