summaryrefslogtreecommitdiff
path: root/x11-wm/dwm/files/04_push.diff
diff options
context:
space:
mode:
Diffstat (limited to 'x11-wm/dwm/files/04_push.diff')
-rw-r--r--x11-wm/dwm/files/04_push.diff83
1 files changed, 83 insertions, 0 deletions
diff --git a/x11-wm/dwm/files/04_push.diff b/x11-wm/dwm/files/04_push.diff
new file mode 100644
index 0000000..b79db76
--- /dev/null
+++ b/x11-wm/dwm/files/04_push.diff
@@ -0,0 +1,83 @@
+diff --git c/config.def.h w/config.def.h
+index 19600a6..228e71d 100644
+--- c/config.def.h
++++ w/config.def.h
+@@ -75,6 +75,8 @@ static const Key keys[] = {
+ { MODKEY, XK_b, togglebar, {0} },
+ { MODKEY, XK_j, focusstack, {.i = +1 } },
+ { MODKEY, XK_k, focusstack, {.i = -1 } },
++ { MODKEY|ShiftMask, XK_j, pushdown, {0} },
++ { MODKEY|ShiftMask, XK_k, pushup, {0} },
+ { MODKEY, XK_i, incnmaster, {.i = +1 } },
+ { MODKEY, XK_d, incnmaster, {.i = -1 } },
+ { MODKEY, XK_h, setmfact, {.f = -0.05} },
+diff --git c/dwm.c w/dwm.c
+index c68b29a..e5496bf 100644
+--- c/dwm.c
++++ w/dwm.c
+@@ -188,7 +188,10 @@ static void motionnotify(XEvent *e);
+ static void movemouse(const Arg *arg);
+ static Client *nexttiled(Client *c);
+ static void pop(Client *c);
++static Client *prevtiled(Client *c);
+ static void propertynotify(XEvent *e);
++static void pushdown(const Arg *arg);
++static void pushup(const Arg *arg);
+ static void quit(const Arg *arg);
+ static Monitor *recttomon(int x, int y, int w, int h);
+ static void resize(Client *c, int x, int y, int w, int h, int interact);
+@@ -1262,6 +1265,16 @@ pop(Client *c)
+ arrange(c->mon);
+ }
+
++Client *
++prevtiled(Client *c) {
++ Client *p, *r;
++
++ for(p = selmon->clients, r = NULL; p && p != c; p = p->next)
++ if(!p->isfloating && ISVISIBLE(p))
++ r = p;
++ return r;
++}
++
+ void
+ propertynotify(XEvent *e)
+ {
+@@ -1299,6 +1312,37 @@ propertynotify(XEvent *e)
+ }
+ }
+
++void
++pushdown(const Arg *arg) {
++ Client *sel = selmon->sel, *c;
++
++ if(!sel || sel->isfloating || sel == nexttiled(selmon->clients))
++ return;
++ if((c = nexttiled(sel->next))) {
++ detach(sel);
++ sel->next = c->next;
++ c->next = sel;
++ }
++ focus(sel);
++ arrange(selmon);
++}
++
++void
++pushup(const Arg *arg) {
++ Client *sel = selmon->sel, *c;
++
++ if(!sel || sel->isfloating)
++ return;
++ if((c = prevtiled(sel)) && c != nexttiled(selmon->clients)) {
++ detach(sel);
++ sel->next = c;
++ for(c = selmon->clients; c->next != sel->next; c = c->next);
++ c->next = sel;
++ }
++ focus(sel);
++ arrange(selmon);
++}
++
+ void
+ quit(const Arg *arg)
+ {