summarylogtreecommitdiffstats
path: root/dwm-rotatestack-20161021-ab9571b.diff
diff options
context:
space:
mode:
authorJean-Francois Chevrette2020-03-28 18:25:48 -0400
committerJean-Francois Chevrette2020-03-28 18:25:48 -0400
commitc60117e83efbbb05b021436c9d9cf5dda72554bb (patch)
tree1e08b5dc353f469c40650d9089055da759878d84 /dwm-rotatestack-20161021-ab9571b.diff
parent06f8b53f4b76b52bc8028067b8b6e5dcbfd118a7 (diff)
downloadaur-dwm-jfchevrette.tar.gz
add patches
Diffstat (limited to 'dwm-rotatestack-20161021-ab9571b.diff')
-rw-r--r--dwm-rotatestack-20161021-ab9571b.diff102
1 files changed, 102 insertions, 0 deletions
diff --git a/dwm-rotatestack-20161021-ab9571b.diff b/dwm-rotatestack-20161021-ab9571b.diff
new file mode 100644
index 000000000000..ed74c6dce48e
--- /dev/null
+++ b/dwm-rotatestack-20161021-ab9571b.diff
@@ -0,0 +1,102 @@
+diff --git a/config.def.h b/config.def.h
+index fd77a07..09737d7 100644
+--- a/config.def.h
++++ b/config.def.h
+@@ -64,6 +64,8 @@ static Key keys[] = {
+ { MODKEY, XK_p, spawn, {.v = dmenucmd } },
+ { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
+ { MODKEY, XK_b, togglebar, {0} },
++ { MODKEY|ShiftMask, XK_j, rotatestack, {.i = +1 } },
++ { MODKEY|ShiftMask, XK_k, rotatestack, {.i = -1 } },
+ { MODKEY, XK_j, focusstack, {.i = +1 } },
+ { MODKEY, XK_k, focusstack, {.i = -1 } },
+ { MODKEY, XK_i, incnmaster, {.i = +1 } },
+diff --git a/dwm.c b/dwm.c
+index 421bf27..1ec8b10 100644
+--- a/dwm.c
++++ b/dwm.c
+@@ -165,6 +165,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 enternotify(XEvent *e);
+ static void expose(XEvent *e);
+ static void focus(Client *c);
+@@ -194,6 +196,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);
+@@ -765,6 +768,28 @@ drawbars(void)
+ }
+
+ 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;
+@@ -1390,6 +1415,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;