From 2de3a039af9e6250fe9dce91ab2f193c69242a29 Mon Sep 17 00:00:00 2001 From: zachir Date: Mon, 27 Sep 2021 13:23:22 -0500 Subject: add functions to push up/down including master --- dwm.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'dwm.c') diff --git a/dwm.c b/dwm.c index 603497c..aa637c0 100644 --- a/dwm.c +++ b/dwm.c @@ -1662,6 +1662,50 @@ pushup(const Arg *arg) { arrange(selmon); } +void +pushmdown(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; + } else { + detach(sel); + attach(sel); + } + focus(sel); + arrange(selmon); +} + +void +pushmup(const Arg *arg) { + Client *sel = selmon->sel, *c; + + if(!sel || sel->isfloating) + return; + if((c = prevtiled(sel))) { + detach(sel); + sel->next = c; + if(selmon->clients == c) + selmon->clients = sel; + else { + for(c = selmon->clients; c->next != sel->next; c = c->next); + c->next = sel; + } + } else { + for(c = sel; c->next; c = c->next); + detach(sel); + sel->next = NULL; + c->next = sel; + } + focus(sel); + arrange(selmon); +} + + void quit(const Arg *arg) { -- cgit v1.2.3