summaryrefslogtreecommitdiff
path: root/patch/push_no_master.c
diff options
context:
space:
mode:
authorBear <bear@bengtsson.win>2021-12-27 09:29:58 +0000
committerBear <bear@bengtsson.win>2021-12-27 09:29:58 +0000
commit69262b01ced79c2d776fab9b889926d1816a1e7a (patch)
treef304cd6fa8734e83a7772d07dc9b484781565155 /patch/push_no_master.c
Added DWM
Diffstat (limited to 'patch/push_no_master.c')
-rw-r--r--patch/push_no_master.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/patch/push_no_master.c b/patch/push_no_master.c
new file mode 100644
index 0000000..2d78cf4
--- /dev/null
+++ b/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);
+}
+