commit b2efb391b9ad4d5f90c3ed1c887e9c03b6a0dffd
Author: Jan Christoph Ebersbach <[email protected]>
Date:   Sun Jul 31 07:56:36 2016 +0200

    Update patch zoomswap

diff --git a/dwm.suckless.org/patches/dwm-zoomswap-20160731-56a31dc.diff 
b/dwm.suckless.org/patches/dwm-zoomswap-20160731-56a31dc.diff
new file mode 100644
index 0000000..99672ec
--- /dev/null
+++ b/dwm.suckless.org/patches/dwm-zoomswap-20160731-56a31dc.diff
@@ -0,0 +1,86 @@
+Author: Jan Christoph Ebersbach <[email protected]>
+URL: http://dwm.suckless.org/patches/zoomswap
+This patch swaps the current window with the previous master when zooming.
+
+Index: dwm/dwm.c
+===================================================================
+--- dwm/dwm.c.orig
++++ dwm/dwm.c
+@@ -236,6 +236,7 @@ static int xerrorstart(Display *dpy, XEr
+ static void zoom(const Arg *arg);
+ 
+ /* variables */
++static Client *prevzoom = NULL;
+ static const char broken[] = "broken";
+ static char stext[256];
+ static int screen;
+@@ -2109,14 +2110,38 @@ void
+ zoom(const Arg *arg)
+ {
+       Client *c = selmon->sel;
++      Client *at = NULL, *cold, *cprevious = NULL;
+ 
+       if (!selmon->lt[selmon->sellt]->arrange
+       || (selmon->sel && selmon->sel->isfloating))
+               return;
+-      if (c == nexttiled(selmon->clients))
+-              if (!c || !(c = nexttiled(c->next)))
+-                      return;
+-      pop(c);
++      if (c == nexttiled(selmon->clients)) {
++              at = findbefore(prevzoom);
++              if (at)
++                      cprevious = nexttiled(at->next);
++              if (!cprevious || cprevious != prevzoom) {
++                      prevzoom = NULL;
++                      if(!c || !(c = nexttiled(c->next)))
++                              return;
++              } else
++                      c = cprevious;
++      }
++      cold = nexttiled(selmon->clients);
++      if (c != cold && !at)
++              at = findbefore(c);
++      detach(c);
++      attach(c);
++      /* swap windows instead of pushing the previous one down */
++      if (c != cold && at) {
++              prevzoom = cold;
++              if(cold && at != cold) {
++                      detach(cold);
++                      cold->next = at->next;
++                      at->next = cold;
++              }
++      }
++      focus(c);
++      arrange(c->mon);
+ }
+ 
+ int
+Index: dwm/zoomswap.c
+===================================================================
+--- /dev/null
++++ dwm/zoomswap.c
+@@ -0,0 +1,10 @@
++static Client * findbefore(Client *c);
++
++Client *
++findbefore(Client *c) {
++      Client *tmp;
++      if(c == selmon->clients)
++              return NULL;
++      for(tmp = selmon->clients; tmp && tmp->next != c; tmp = tmp->next) ;
++      return tmp;
++}
+Index: dwm/config.def.h
+===================================================================
+--- dwm/config.def.h.orig
++++ dwm/config.def.h
+@@ -59,6 +59,7 @@ static char dmenumon[2] = "0"; /* compon
+ static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", 
dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", 
col_gray4, NULL };
+ static const char *termcmd[]  = { "st", NULL };
+ 
++#include "zoomswap.c"
+ static Key keys[] = {
+       /* modifier                     key        function        argument */
+       { MODKEY,                       XK_p,      spawn,          {.v = 
dmenucmd } },
diff --git a/dwm.suckless.org/patches/zoomswap.md 
b/dwm.suckless.org/patches/zoomswap.md
index 6052f49..da4345c 100644
--- a/dwm.suckless.org/patches/zoomswap.md
+++ b/dwm.suckless.org/patches/zoomswap.md
@@ -43,6 +43,7 @@ Download
 Patches against different versions of dwm are available at
 [dwm-clean-patches](https://github.com/jceb/dwm-clean-patches).
 
+ * [dwm-zoomswap-20160731-56a31dc.diff](dwm-zoomswap-20160731-56a31dc.diff)
  * [dwm-6.1-zoomswap.diff](dwm-6.1-zoomswap.diff) (2585b) (20120406)
  * [dwm-10e232f9ace7-attachabove.diff](dwm-10e232f9ace7-attachabove.diff) 
(1.7K) (20120406)
  * [dwm-zoomswap-6.0.diff](dwm-zoomswap-6.0.diff) (1.6K) (20120406)


Reply via email to