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 --- config.h | 2 ++ dwm.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/config.h b/config.h index fd82e2c..cea96be 100644 --- a/config.h +++ b/config.h @@ -178,6 +178,8 @@ static Key keys[] = { { MODKEY, XK_k, focusstack, {.i = -1 } }, { MODKEY|ShiftMask, XK_j, pushdown, {.i = +1 } }, { MODKEY|ShiftMask, XK_k, pushup, {.i = -1 } }, + { MODKEY|Mod4Mask, XK_j, pushmdown, {.i = +1 } }, + { MODKEY|Mod4Mask, XK_k, pushmup, {.i = -1 } }, { MODKEY|ControlMask, XK_k, setcfact, {.f = +0.25} }, { MODKEY|ControlMask, XK_j, setcfact, {.f = -0.25} }, { MODKEY|ControlMask, XK_o, setcfact, {.f = 0.00} }, 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