diff options
author | zachir <zachir@librem.one> | 2021-09-27 13:23:22 -0500 |
---|---|---|
committer | zachir <zachir@librem.one> | 2021-09-27 13:23:22 -0500 |
commit | 2de3a039af9e6250fe9dce91ab2f193c69242a29 (patch) | |
tree | aeee0d56b4b72a14e37dda38cca39cf06b6b6107 | |
parent | f98473dcdf731ca11ceed89924a477c8d4597fc0 (diff) |
add functions to push up/down including master
-rw-r--r-- | config.h | 2 | ||||
-rw-r--r-- | dwm.c | 44 |
2 files changed, 46 insertions, 0 deletions
@@ -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} }, @@ -1663,6 +1663,50 @@ pushup(const Arg *arg) { } 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) { if(arg->i) restart = 1; |