dwm-push_no_master-6.0.diff (1509B)
1 --- dwm.c 2013-03-19 00:55:43.913249297 +0100 2 +++ dwm.c 2013-03-19 00:58:46.489912892 +0100 3 @@ -217,7 +217,10 @@ 4 static void movemouse(const Arg *arg); 5 static Client *nexttiled(Client *c); 6 static void pop(Client *); 7 +static Client *prevtiled(Client *c); 8 static void propertynotify(XEvent *e); 9 +static void pushdown(const Arg *arg); 10 +static void pushup(const Arg *arg); 11 static void quit(const Arg *arg); 12 static Monitor *recttomon(int x, int y, int w, int h); 13 static void resize(Client *c, int x, int y, int w, int h, Bool interact); 14 @@ -1421,6 +1424,16 @@ 15 arrange(c->mon); 16 } 17 18 +Client * 19 +prevtiled(Client *c) { 20 + Client *p, *r; 21 + 22 + for(p = selmon->clients, r = NULL; p && p != c; p = p->next) 23 + if(!p->isfloating && ISVISIBLE(p)) 24 + r = p; 25 + return r; 26 +} 27 + 28 void 29 propertynotify(XEvent *e) { 30 Client *c; 31 @@ -1458,6 +1471,37 @@ 32 } 33 34 void 35 +pushdown(const Arg *arg) { 36 + Client *sel = selmon->sel, *c; 37 + 38 + if(!sel || sel->isfloating || sel == nexttiled(selmon->clients)) 39 + return; 40 + if((c = nexttiled(sel->next))) { 41 + detach(sel); 42 + sel->next = c->next; 43 + c->next = sel; 44 + } 45 + focus(sel); 46 + arrange(selmon); 47 +} 48 + 49 +void 50 +pushup(const Arg *arg) { 51 + Client *sel = selmon->sel, *c; 52 + 53 + if(!sel || sel->isfloating) 54 + return; 55 + if((c = prevtiled(sel)) && c != nexttiled(selmon->clients)) { 56 + detach(sel); 57 + sel->next = c; 58 + for(c = selmon->clients; c->next != sel->next; c = c->next); 59 + c->next = sel; 60 + } 61 + focus(sel); 62 + arrange(selmon); 63 +} 64 + 65 +void 66 quit(const Arg *arg) { 67 running = False; 68 }