diff options
| author | bakkeby <[email protected]> | 2019-09-07 22:42:01 +0200 |
|---|---|---|
| committer | bakkeby <[email protected]> | 2019-09-07 22:42:01 +0200 |
| commit | 7c23a59c38d01a0fae1edf360b4553fe3a0d9e23 (patch) | |
| tree | 6e4b78fccba8ceb26e9a5c5534acc0d674afa84b /patch | |
| parent | 2f4916a64eeed1b8b6dc74b8dd728b27cca53a09 (diff) | |
| download | dwm-flexipatch-7c23a59c38d01a0fae1edf360b4553fe3a0d9e23.tar.gz dwm-flexipatch-7c23a59c38d01a0fae1edf360b4553fe3a0d9e23.zip | |
Adding rotatestack patch
Diffstat (limited to 'patch')
| -rw-r--r-- | patch/include.c | 4 | ||||
| -rw-r--r-- | patch/include.h | 6 | ||||
| -rw-r--r-- | patch/rotatestack.c | 52 | ||||
| -rw-r--r-- | patch/rotatestack.h | 3 |
4 files changed, 64 insertions, 1 deletions
diff --git a/patch/include.c b/patch/include.c index 0c59c0f..b5cf100 100644 --- a/patch/include.c +++ b/patch/include.c @@ -18,6 +18,10 @@ #include "pertag.c" #endif +#if ROTATESTACK_PATCH +#include "rotatestack.c" +#endif + #if SYSTRAY_PATCH #include "systray.c" #endif diff --git a/patch/include.h b/patch/include.h index 17d6c9e..e324b55 100644 --- a/patch/include.h +++ b/patch/include.h @@ -12,7 +12,11 @@ #if CYCLELAYOUTS_PATCH #include "cyclelayouts.h" -#endif // CYCLELAYOUTS_PATCH +#endif + +#if ROTATESTACK_PATCH +#include "rotatestack.h" +#endif #if SYSTRAY_PATCH #include "systray.h" diff --git a/patch/rotatestack.c b/patch/rotatestack.c new file mode 100644 index 0000000..d2f7d50 --- /dev/null +++ b/patch/rotatestack.c @@ -0,0 +1,52 @@ +void +enqueue(Client *c) +{ + Client *l; + for (l = c->mon->clients; l && l->next; l = l->next); + if (l) { + l->next = c; + c->next = NULL; + } +} + +void +enqueuestack(Client *c) +{ + Client *l; + for (l = c->mon->stack; l && l->snext; l = l->snext); + if (l) { + l->snext = c; + c->snext = NULL; + } +} + +void +rotatestack(const Arg *arg) +{ + Client *c = NULL, *f; + + if (!selmon->sel) + return; + f = selmon->sel; + if (arg->i > 0) { + for (c = nexttiled(selmon->clients); c && nexttiled(c->next); c = nexttiled(c->next)); + if (c){ + detach(c); + attach(c); + detachstack(c); + attachstack(c); + } + } else { + if ((c = nexttiled(selmon->clients))){ + detach(c); + enqueue(c); + detachstack(c); + enqueuestack(c); + } + } + if (c){ + arrange(selmon); + focus(f); + restack(selmon); + } +}
\ No newline at end of file diff --git a/patch/rotatestack.h b/patch/rotatestack.h new file mode 100644 index 0000000..c0661fa --- /dev/null +++ b/patch/rotatestack.h @@ -0,0 +1,3 @@ +static void enqueue(Client *c); +static void enqueuestack(Client *c); +static void rotatestack(const Arg *arg);
\ No newline at end of file |
