dwm-push-6.0.diff (1332B)
1 URL: http://dwm.suckless.org/patches/push 2 pushup and pushdown provide a way to move clients inside the clients list. 3 4 diff -r ec4baab78314 push.c 5 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 6 +++ b/push.c Fri Apr 06 08:23:37 2012 +0200 7 @@ -0,0 +1,58 @@ 8 +static Client * 9 +prevtiled(Client *c) { 10 + Client *p, *r; 11 + 12 + for(p = selmon->clients, r = NULL; p && p != c; p = p->next) 13 + if(!p->isfloating && ISVISIBLE(p)) 14 + r = p; 15 + return r; 16 +} 17 + 18 +static void 19 +pushup(const Arg *arg) { 20 + Client *sel = selmon->sel; 21 + Client *c; 22 + 23 + if(!sel || sel->isfloating) 24 + return; 25 + if((c = prevtiled(sel))) { 26 + /* attach before c */ 27 + detach(sel); 28 + sel->next = c; 29 + if(selmon->clients == c) 30 + selmon->clients = sel; 31 + else { 32 + for(c = selmon->clients; c->next != sel->next; c = c->next); 33 + c->next = sel; 34 + } 35 + } else { 36 + /* move to the end */ 37 + for(c = sel; c->next; c = c->next); 38 + detach(sel); 39 + sel->next = NULL; 40 + c->next = sel; 41 + } 42 + focus(sel); 43 + arrange(selmon); 44 +} 45 + 46 +static void 47 +pushdown(const Arg *arg) { 48 + Client *sel = selmon->sel; 49 + Client *c; 50 + 51 + if(!sel || sel->isfloating) 52 + return; 53 + if((c = nexttiled(sel->next))) { 54 + /* attach after c */ 55 + detach(sel); 56 + sel->next = c->next; 57 + c->next = sel; 58 + } else { 59 + /* move to the front */ 60 + detach(sel); 61 + attach(sel); 62 + } 63 + focus(sel); 64 + arrange(selmon); 65 +}