1
0
mirror of https://github.com/tiyn/dwm.git synced 2026-01-02 07:29:47 +01:00

added cyclelayouts patch to master

This commit is contained in:
2023-10-24 03:35:10 +02:00
5 changed files with 277 additions and 148 deletions

18
dwm.c
View File

@@ -187,6 +187,7 @@ static void configurerequest(XEvent *e);
static void copyvalidchars(char *text, char *rawtext);
static Monitor *createmon(void);
static void deck(Monitor *m);
static void cyclelayout(const Arg *arg);
static void destroynotify(XEvent *e);
static void detach(Client *c);
static void detachstack(Client *c);
@@ -809,6 +810,23 @@ createmon(void)
return m;
}
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] }));
}
}
void
destroynotify(XEvent *e)
{