summaryrefslogtreecommitdiff
path: root/dwm-push-20201112-61bb8b2.diff
diff options
context:
space:
mode:
Diffstat (limited to 'dwm-push-20201112-61bb8b2.diff')
-rw-r--r--dwm-push-20201112-61bb8b2.diff94
1 files changed, 94 insertions, 0 deletions
diff --git a/dwm-push-20201112-61bb8b2.diff b/dwm-push-20201112-61bb8b2.diff
new file mode 100644
index 0000000..c228b66
--- /dev/null
+++ b/dwm-push-20201112-61bb8b2.diff
@@ -0,0 +1,94 @@
+From b2faf234f21e61327ded730024db37bb36635e30 Mon Sep 17 00:00:00 2001
+From: Alex Cole <ajzcole@airmail.cc>
+Date: Thu, 12 Nov 2020 17:36:52 +1300
+Subject: [PATCH] Push patch added
+
+---
+ dwm.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 56 insertions(+)
+
+diff --git a/dwm.c b/dwm.c
+index 664c527..039ab00 100644
+--- a/dwm.c
++++ b/dwm.c
+@@ -186,7 +186,10 @@ static void motionnotify(XEvent *e);
+ static void movemouse(const Arg *arg);
+ static Client *nexttiled(Client *c);
+ static void pop(Client *);
++static Client *prevtiled(Client *c);
+ static void propertynotify(XEvent *e);
++static void pushdown(const Arg *arg);
++static void pushup(const Arg *arg);
+ static void quit(const Arg *arg);
+ static Monitor *recttomon(int x, int y, int w, int h);
+ static void resize(Client *c, int x, int y, int w, int h, int interact);
+@@ -1209,6 +1212,16 @@ pop(Client *c)
+ arrange(c->mon);
+ }
+
++Client *
++prevtiled(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
+ propertynotify(XEvent *e)
+ {
+@@ -1246,6 +1259,49 @@ propertynotify(XEvent *e)
+ }
+ }
+
++void
++pushdown(const Arg *arg) {
++ Client *sel = selmon->sel, *c;
++
++ if(!sel || sel->isfloating)
++ 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
++pushup(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)
+ {
+--
+2.29.2
+