summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--config.def.h4
-rw-r--r--patch/include.c4
-rw-r--r--patch/include.h4
-rw-r--r--patch/push.c4
-rw-r--r--patch/push_no_master.c43
-rw-r--r--patch/push_no_master.h3
-rw-r--r--patches.h8
8 files changed, 65 insertions, 7 deletions
diff --git a/README.md b/README.md
index 22dbed4..8df9b4c 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
### Changelog:
-2019-09-14 - Added setborderpx and selfrestart patches
+2019-09-14 - Added setborderpx, selfrestart and push (no master variant) patches
2019-09-13 - Added titlecolor and push patches
diff --git a/config.def.h b/config.def.h
index 9803c9c..11301d7 100644
--- a/config.def.h
+++ b/config.def.h
@@ -235,10 +235,10 @@ static Key keys[] = {
{ MODKEY|ShiftMask, XK_j, rotatestack, {.i = +1 } },
{ MODKEY|ShiftMask, XK_k, rotatestack, {.i = -1 } },
#endif // ROTATESTACK_PATCH
- #if PUSH_PATCH
+ #if PUSH_PATCH || PUSH_NO_MASTER_PATCH
{ MODKEY|ControlMask, XK_j, pushdown, {0} },
{ MODKEY|ControlMask, XK_k, pushup, {0} },
- #endif // PUSH_PATCH
+ #endif // PUSH_PATCH / PUSH_NO_MASTER_PATCH
{ MODKEY, XK_i, incnmaster, {.i = +1 } },
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
diff --git a/patch/include.c b/patch/include.c
index 8a76a60..86de400 100644
--- a/patch/include.c
+++ b/patch/include.c
@@ -40,7 +40,9 @@
#include "pertag.c"
#endif
-#if PUSH_PATCH
+#if PUSH_NO_MASTER_PATCH
+#include "push_no_master.c"
+#elif PUSH_PATCH
#include "push.c"
#endif
diff --git a/patch/include.h b/patch/include.h
index 924ffff..e2d73df 100644
--- a/patch/include.h
+++ b/patch/include.h
@@ -36,7 +36,9 @@
#include "ewmhtags.h"
#endif
-#if PUSH_PATCH
+#if PUSH_NO_MASTER_PATCH
+#include "push_no_master.h"
+#elif PUSH_PATCH
#include "push.h"
#endif
diff --git a/patch/push.c b/patch/push.c
index 6ac156f..beeea91 100644
--- a/patch/push.c
+++ b/patch/push.c
@@ -1,4 +1,4 @@
-Client *
+static Client *
nextc(Client *c, float f)
{
if (!f)
@@ -34,7 +34,7 @@ pushup(const Arg *arg)
if (selmon->clients == c)
selmon->clients = sel;
else {
- for (c = selmon->clients; c->next != sel->next; c = c->next);
+ for (c f selmon->clients; c->next != sel->next; c = c->next);
c->next = sel;
}
} else {
diff --git a/patch/push_no_master.c b/patch/push_no_master.c
new file mode 100644
index 0000000..5ff9326
--- /dev/null
+++ b/patch/push_no_master.c
@@ -0,0 +1,43 @@
+Client *
+prevt(Client *c)
+{
+ Client *p, *r;
+
+ for (p = selmon->clients, r = NULL; p && p != c; p = p->next)
+ if (!p->isfloating && ISVISIBLE(p))
+ r = p;
+ return r;
+}
+
+void
+pushup(const Arg *arg)
+{
+ Client *sel = selmon->sel, *c;
+
+ if (!sel || sel->isfloating)
+ return;
+ if ((c = prevt(sel)) && c != nexttiled(selmon->clients)) {
+ detach(sel);
+ sel->next = c;
+ for (c = selmon->clients; c->next != sel->next; c = c->next);
+ c->next = sel;
+ }
+ focus(sel);
+ arrange(selmon);
+}
+
+void
+pushdown(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;
+ }
+ focus(sel);
+ arrange(selmon);
+} \ No newline at end of file
diff --git a/patch/push_no_master.h b/patch/push_no_master.h
new file mode 100644
index 0000000..7ea061d
--- /dev/null
+++ b/patch/push_no_master.h
@@ -0,0 +1,3 @@
+Client * prevt(Client *c);
+static void pushup(const Arg *arg);
+static void pushdown(const Arg *arg); \ No newline at end of file
diff --git a/patches.h b/patches.h
index 4b12fdc..f19a125 100644
--- a/patches.h
+++ b/patches.h
@@ -169,6 +169,14 @@
*/
#define PUSH_PATCH 0
+/* This patch provides a way to move clients up and down inside the client list,
+ * but does not push up or down into the master area (except that it does not take
+ * nmaster into account).
+ * This takes precedence over the push patch above.
+ * https://dwm.suckless.org/patches/push/
+ */
+#define PUSH_NO_MASTER_PATCH 0
+
/* By default, windows only resize from the bottom right corner. With this
* patch the mouse is warped to the nearest corner and you resize from there.
* https://dwm.suckless.org/patches/resizecorners/