summaryrefslogtreecommitdiff
path: root/dwm/patch/push_no_master.c
diff options
context:
space:
mode:
authorcoasteen <coasteen@proton.me>2026-07-09 10:42:28 +0330
committercoasteen <coasteen@proton.me>2026-07-09 10:42:28 +0330
commit8cbadb61604667b407b53ee1258433994fa4765a (patch)
tree97765fb29418fd6278fcb4cbb9760893afaf7a58 /dwm/patch/push_no_master.c
Diffstat (limited to 'dwm/patch/push_no_master.c')
-rwxr-xr-xdwm/patch/push_no_master.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/dwm/patch/push_no_master.c b/dwm/patch/push_no_master.c
new file mode 100755
index 0000000..2d78cf4
--- /dev/null
+++ b/dwm/patch/push_no_master.c
@@ -0,0 +1,44 @@
+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);
+}
+