summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzachir <zachir@librem.one>2021-09-27 13:23:22 -0500
committerzachir <zachir@librem.one>2021-09-27 13:23:22 -0500
commit2de3a039af9e6250fe9dce91ab2f193c69242a29 (patch)
treeaeee0d56b4b72a14e37dda38cca39cf06b6b6107
parentf98473dcdf731ca11ceed89924a477c8d4597fc0 (diff)
add functions to push up/down including master
-rw-r--r--config.h2
-rw-r--r--dwm.c44
2 files changed, 46 insertions, 0 deletions
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
@@ -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;