diff options
author | rafa_99 <rafa99@protonmail.com> | 2020-02-02 01:03:23 +0000 |
---|---|---|
committer | rafa_99 <rafa99@protonmail.com> | 2020-02-02 01:03:23 +0000 |
commit | 4b6fa6275aee53e368fb36889139b7c6b407bdb0 (patch) | |
tree | 8da85a842904259035e64a8bf2e08c581b3c0a3a /dwm.c | |
parent | 852ae63fd8c6cf6a35c02ec750f992f8c01f00d1 (diff) |
Rotate Stack Patch
Diffstat (limited to 'dwm.c')
-rw-r--r-- | dwm.c | 57 |
1 files changed, 57 insertions, 0 deletions
@@ -169,6 +169,8 @@ static void detachstack(Client *c); static Monitor *dirtomon(int dir); static void drawbar(Monitor *m); static void drawbars(void); +static void enqueue(Client *c); +static void enqueuestack(Client *c); static void dwindle(Monitor *mon); static void enternotify(XEvent *e); static void expose(XEvent *e); @@ -201,6 +203,7 @@ static void resize(Client *c, int x, int y, int w, int h, int interact); static void resizeclient(Client *c, int x, int y, int w, int h); static void resizemouse(const Arg *arg); static void restack(Monitor *m); +static void rotatestack(const Arg *arg); static void run(void); static void scan(void); static int sendevent(Client *c, Atom proto); @@ -791,6 +794,28 @@ dwindle(Monitor *mon) { } 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 enternotify(XEvent *e) { Client *c; @@ -1481,6 +1506,38 @@ restack(Monitor *m) } 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); + //unfocus(f, 1); + focus(f); + restack(selmon); + } +} + +void run(void) { XEvent ev; |