mirror of
https://github.com/mintycube/dwm.git
synced 2024-10-22 14:05:45 +02:00
cyclelayouts: reimplementing patch to not require the NULL layout, addresses #331
This commit is contained in:
parent
954e60b735
commit
f713ddee39
@ -704,9 +704,6 @@ static const Layout layouts[] = {
|
|||||||
#if NROWGRID_LAYOUT
|
#if NROWGRID_LAYOUT
|
||||||
{ "###", nrowgrid, {0} },
|
{ "###", nrowgrid, {0} },
|
||||||
#endif
|
#endif
|
||||||
#if CYCLELAYOUTS_PATCH
|
|
||||||
{ NULL, NULL, {0} },
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
#else
|
#else
|
||||||
static const Layout layouts[] = {
|
static const Layout layouts[] = {
|
||||||
@ -754,9 +751,6 @@ static const Layout layouts[] = {
|
|||||||
#if NROWGRID_LAYOUT
|
#if NROWGRID_LAYOUT
|
||||||
{ "###", nrowgrid },
|
{ "###", nrowgrid },
|
||||||
#endif
|
#endif
|
||||||
#if CYCLELAYOUTS_PATCH
|
|
||||||
{ NULL, NULL },
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
#endif // FLEXTILE_DELUXE_LAYOUT
|
#endif // FLEXTILE_DELUXE_LAYOUT
|
||||||
|
|
||||||
|
@ -1,18 +1,10 @@
|
|||||||
void
|
void
|
||||||
cyclelayout(const Arg *arg)
|
cyclelayout(const Arg *arg)
|
||||||
{
|
{
|
||||||
Layout *l;
|
int i;
|
||||||
for (l = (Layout *)layouts; l != selmon->lt[selmon->sellt]; l++);
|
int num_layouts = LENGTH(layouts);
|
||||||
if (arg->i > 0) {
|
|
||||||
if (l->symbol && (l + 1)->symbol)
|
|
||||||
setlayout(&((Arg) { .v = (l + 1) }));
|
|
||||||
else
|
|
||||||
setlayout(&((Arg) { .v = layouts }));
|
|
||||||
} else {
|
|
||||||
if (l != layouts && (l - 1)->symbol)
|
|
||||||
setlayout(&((Arg) { .v = (l - 1) }));
|
|
||||||
else
|
|
||||||
setlayout(&((Arg) { .v = &layouts[LENGTH(layouts) - 2] }));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
for (i = 0; i < num_layouts && &layouts[i] != selmon->lt[selmon->sellt]; i++);
|
||||||
|
i += arg->i;
|
||||||
|
setlayout(&((Arg) { .v = &layouts[(i % num_layouts + num_layouts) % num_layouts] })); // modulo
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user