]> git.mdlowis.com Git - proto/iwe.git/commitdiff
Applied dwm push patch cleanly
authorMike Lowis <mike.lowis@gentex.com>
Fri, 16 Sep 2016 12:56:42 +0000 (08:56 -0400)
committerMike Lowis <mike.lowis@gentex.com>
Fri, 16 Sep 2016 12:56:42 +0000 (08:56 -0400)
dwm/push.c [new file with mode: 0644]
patches/dwm-push-6.1.diff [new file with mode: 0644]

diff --git a/dwm/push.c b/dwm/push.c
new file mode 100644 (file)
index 0000000..493613c
--- /dev/null
@@ -0,0 +1,58 @@
+static 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;
+}
+
+static void
+pushup(const Arg *arg) {
+       Client *sel = selmon->sel;
+       Client *c;
+
+       if(!sel || sel->isfloating)
+               return;
+       if((c = prevtiled(sel))) {
+               /* attach before c */
+               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 {
+               /* move to the end */
+               for(c = sel; c->next; c = c->next);
+               detach(sel);
+               sel->next = NULL;
+               c->next = sel;
+       }
+       focus(sel);
+       arrange(selmon);
+}
+
+static void
+pushdown(const Arg *arg) {
+       Client *sel = selmon->sel;
+       Client *c;
+
+       if(!sel || sel->isfloating)
+               return;
+       if((c = nexttiled(sel->next))) {
+               /* attach after c */
+               detach(sel);
+               sel->next = c->next;
+               c->next = sel;
+       } else {
+               /* move to the front */
+               detach(sel);
+               attach(sel);
+       }
+       focus(sel);
+       arrange(selmon);
+}
diff --git a/patches/dwm-push-6.1.diff b/patches/dwm-push-6.1.diff
new file mode 100644 (file)
index 0000000..170f784
--- /dev/null
@@ -0,0 +1,66 @@
+URL: http://dwm.suckless.org/patches/push
+pushup and pushdown provide a way to move clients inside the clients list.
+
+Index: dwm/push.c
+===================================================================
+--- /dev/null  1970-01-01 00:00:00.000000000 +0000
++++ dwm/push.c 2014-02-09 15:24:21.652117230 +0100
+@@ -0,0 +1,58 @@
++static 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;
++}
++
++static void
++pushup(const Arg *arg) {
++      Client *sel = selmon->sel;
++      Client *c;
++
++      if(!sel || sel->isfloating)
++              return;
++      if((c = prevtiled(sel))) {
++              /* attach before c */
++              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 {
++              /* move to the end */
++              for(c = sel; c->next; c = c->next);
++              detach(sel);
++              sel->next = NULL;
++              c->next = sel;
++      }
++      focus(sel);
++      arrange(selmon);
++}
++
++static void
++pushdown(const Arg *arg) {
++      Client *sel = selmon->sel;
++      Client *c;
++
++      if(!sel || sel->isfloating)
++              return;
++      if((c = nexttiled(sel->next))) {
++              /* attach after c */
++              detach(sel);
++              sel->next = c->next;
++              c->next = sel;
++      } else {
++              /* move to the front */
++              detach(sel);
++              attach(sel);
++      }
++      focus(sel);
++      arrange(selmon);
++}