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
|
||||
{ "###", nrowgrid, {0} },
|
||||
#endif
|
||||
#if CYCLELAYOUTS_PATCH
|
||||
{ NULL, NULL, {0} },
|
||||
#endif
|
||||
};
|
||||
#else
|
||||
static const Layout layouts[] = {
|
||||
@ -754,9 +751,6 @@ static const Layout layouts[] = {
|
||||
#if NROWGRID_LAYOUT
|
||||
{ "###", nrowgrid },
|
||||
#endif
|
||||
#if CYCLELAYOUTS_PATCH
|
||||
{ NULL, NULL },
|
||||
#endif
|
||||
};
|
||||
#endif // FLEXTILE_DELUXE_LAYOUT
|
||||
|
||||
|
@ -1,18 +1,10 @@
|
||||
void
|
||||
cyclelayout(const Arg *arg)
|
||||
{
|
||||
Layout *l;
|
||||
for (l = (Layout *)layouts; l != selmon->lt[selmon->sellt]; l++);
|
||||
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] }));
|
||||
}
|
||||
}
|
||||
int i;
|
||||
int num_layouts = LENGTH(layouts);
|
||||
|
||||
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