dwm-push_no_master-6.4.diff (1546B)
1 diff --git a/dwm.c b/dwm.c 2 index e5efb6a..660a8ac 100644 3 --- a/dwm.c 4 +++ b/dwm.c 5 @@ -186,7 +186,10 @@ static void motionnotify(XEvent *e); 6 static void movemouse(const Arg *arg); 7 static Client *nexttiled(Client *c); 8 static void pop(Client *c); 9 +static Client *prevtiled(Client *c); 10 static void propertynotify(XEvent *e); 11 +static void pushdown(const Arg *arg); 12 +static void pushup(const Arg *arg); 13 static void quit(const Arg *arg); 14 static Monitor *recttomon(int x, int y, int w, int h); 15 static void resize(Client *c, int x, int y, int w, int h, int interact); 16 @@ -1209,6 +1212,16 @@ pop(Client *c) 17 arrange(c->mon); 18 } 19 20 +Client * 21 +prevtiled(Client *c) { 22 + Client *p, *r; 23 + 24 + for(p = selmon->clients, r = NULL; p && p != c; p = p->next) 25 + if(!p->isfloating && ISVISIBLE(p)) 26 + r = p; 27 + return r; 28 +} 29 + 30 void 31 propertynotify(XEvent *e) 32 { 33 @@ -1246,6 +1259,37 @@ propertynotify(XEvent *e) 34 } 35 } 36 37 +void 38 +pushdown(const Arg *arg) { 39 + Client *sel = selmon->sel, *c; 40 + 41 + if(!sel || sel->isfloating || sel == nexttiled(selmon->clients)) 42 + return; 43 + if((c = nexttiled(sel->next))) { 44 + detach(sel); 45 + sel->next = c->next; 46 + c->next = sel; 47 + } 48 + focus(sel); 49 + arrange(selmon); 50 +} 51 + 52 +void 53 +pushup(const Arg *arg) { 54 + Client *sel = selmon->sel, *c; 55 + 56 + if(!sel || sel->isfloating) 57 + return; 58 + if((c = prevtiled(sel)) && c != nexttiled(selmon->clients)) { 59 + detach(sel); 60 + sel->next = c; 61 + for(c = selmon->clients; c->next != sel->next; c = c->next); 62 + c->next = sel; 63 + } 64 + focus(sel); 65 + arrange(selmon); 66 +} 67 + 68 void 69 quit(const Arg *arg) 70 {