sites

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit a9b201c1ce529bf1931909b83ba773963cc1087d
parent f7feb43041187286627515fc4d77005510fef690
Author: Jan Christoph Ebersbach <jceb@e-jc.de>
Date:   Sun,  9 Feb 2014 20:42:28 +0100

update zoomswap patch

Diffstat:
Adwm.suckless.org/patches/dwm-6.1-zoomswap.diff | 86+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mdwm.suckless.org/patches/zoomswap.md | 3++-
2 files changed, 88 insertions(+), 1 deletion(-)

diff --git a/dwm.suckless.org/patches/dwm-6.1-zoomswap.diff b/dwm.suckless.org/patches/dwm-6.1-zoomswap.diff @@ -0,0 +1,86 @@ +Author: Jan Christoph Ebersbach <jceb@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 +@@ -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; +@@ -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 +@@ -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 +@@ -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 @@ -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)