dwm-push-20160731-56a31dc.diff (1514B)
1 URL: http://dwm.suckless.org/patches/push 2 pushup and pushdown provide a way to move clients inside the clients list. 3 4 Index: dwm/push.c 5 =================================================================== 6 --- /dev/null 7 +++ dwm/push.c 8 @@ -0,0 +1,67 @@ 9 +Client * 10 +nextc(Client *c, float f) { 11 + if(!f) 12 + return nexttiled(c); 13 + 14 + for(; c && !ISVISIBLE(c); c = c->next); 15 + return c; 16 +} 17 + 18 +static Client * 19 +prevc(Client *c, float f) { 20 + Client *p, *r; 21 + 22 + for(p = selmon->clients, r = NULL; c && p && p != c; p = p->next) 23 + if((f || !p->isfloating) && ISVISIBLE(p)) 24 + r = p; 25 + return r; 26 +} 27 + 28 +static void 29 +pushup(const Arg *arg) { 30 + Client *sel = selmon->sel; 31 + Client *c; 32 + 33 + if(!sel || (sel->isfloating && !arg->f)) 34 + return; 35 + if((c = prevc(sel, arg->f))) { 36 + /* attach before c */ 37 + detach(sel); 38 + sel->next = c; 39 + if(selmon->clients == c) 40 + selmon->clients = sel; 41 + else { 42 + for(c = selmon->clients; c->next != sel->next; c = c->next); 43 + c->next = sel; 44 + } 45 + } else { 46 + /* move to the end */ 47 + for(c = sel; c->next; c = c->next); 48 + detach(sel); 49 + sel->next = NULL; 50 + c->next = sel; 51 + } 52 + focus(sel); 53 + arrange(selmon); 54 +} 55 + 56 +static void 57 +pushdown(const Arg *arg) { 58 + Client *sel = selmon->sel; 59 + Client *c; 60 + 61 + if(!sel || (sel->isfloating && !arg->f)) 62 + return; 63 + if((c = nextc(sel->next, arg->f))) { 64 + /* attach after c */ 65 + detach(sel); 66 + sel->next = c->next; 67 + c->next = sel; 68 + } else { 69 + /* move to the front */ 70 + detach(sel); 71 + attach(sel); 72 + } 73 + focus(sel); 74 + arrange(selmon); 75 +}