[wiki] [sites] update zoomswap patch || Jan Christoph Ebersbach

From: <git_AT_suckless.org>
Date: Sun, 09 Feb 2014 20:43:06 +0100

commit a9b201c1ce529bf1931909b83ba773963cc1087d
Author: Jan Christoph Ebersbach <jceb_AT_e-jc.de>
Date: Sun Feb 9 20:42:28 2014 +0100

    update zoomswap patch

diff --git a/dwm.suckless.org/patches/dwm-6.1-zoomswap.diff b/dwm.suckless.org/patches/dwm-6.1-zoomswap.diff
new file mode 100644
index 0000000..b732cba
--- /dev/null
+++ b/dwm.suckless.org/patches/dwm-6.1-zoomswap.diff
_AT_@ -0,0 +1,86 @@
+Author: Jan Christoph Ebersbach <jceb_AT_e-jc.de>
+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 2014-02-09 15:24:16.008117074 +0100
++++ dwm/dwm.c 2014-02-09 15:24:16.000117074 +0100
+_AT_@ -234,6 +234,7 @@
+ static void zoom(const Arg *arg);
+
+ /* variables */
++static Client *prevzoom = NULL;
+ static const char broken[] = "broken";
+ static char stext[256];
+ static int screen;
+_AT_@ -2033,14 +2034,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 1970-01-01 00:00:00.000000000 +0000
++++ dwm/zoomswap.c 2014-02-09 15:24:16.004117074 +0100
+_AT_@ -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 2014-02-09 15:24:16.008117074 +0100
++++ dwm/config.def.h 2014-02-09 15:24:16.004117074 +0100
+_AT_@ -54,6 +54,7 @@
+ static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", font, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbgcolor, "-sf", selfgcolor, 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 fd5a6fc..b0cb2b2 100644
--- a/dwm.suckless.org/patches/zoomswap.md
+++ b/dwm.suckless.org/patches/zoomswap.md
_AT_@ -41,8 +41,9 @@ This patch swaps the current window (C) with the previous master (P) when zoomin
 Download
 --------
 Patches against different versions of dwm are available at
-[dwm-clean-patches](https://bitbucket.org/jceb81/dwm-clean-patches/src).
+[dwm-clean-patches](https://github.com/jceb/dwm-clean-patches).
 
+ * [dwm-6.1-zoomswap.diff](dwm-6.1-zoomswap.diff) (2585b) (20120406)
  * [dwm-10e232f9ace7-attachabove.diff](dwm-10e232f9ace7-attachabove.diff) (1.7K) (20120406)
  * [dwm-6.0-zoomswap.diff](dwm-6.0-zoomswap.diff) (1.6K) (20120406)
 
Received on Sun Feb 09 2014 - 20:43:06 CET

This archive was generated by hypermail 2.3.0 : Thu Jun 18 2015 - 17:38:18 CEST