sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

commit 33754b0fe3da51279608807acb1866822d665b7c
parent b288019527388528b53878d1021889f86e15439e
Author: Jan Christoph Ebersbach <jceb@e-jc.de>
Date:   Sun,  9 Feb 2014 20:12:25 +0100

update swapfocus patch

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

diff --git a/dwm.suckless.org/patches/dwm-6.1-swapfocus.diff b/dwm.suckless.org/patches/dwm-6.1-swapfocus.diff @@ -0,0 +1,66 @@ +Author: Jan Christoph Ebersbach <jceb@e-jc.de> +URL: http://dwm.suckless.org/patches/swapfocus +This patch makes it possible to switch focus with one single shortcut (alt-s) +instead of having to think if you should use alt-j or alt-k for reaching the +last used window. + +Index: dwm/dwm.c +=================================================================== +--- dwm/dwm.c.orig 2014-02-09 15:24:14.868117043 +0100 ++++ dwm/dwm.c 2014-02-09 15:24:14.864117043 +0100 +@@ -205,6 +205,7 @@ + static void showhide(Client *c); + static void sigchld(int unused); + static void spawn(const Arg *arg); ++static void swapfocus(); + static void tag(const Arg *arg); + static void tagmon(const Arg *arg); + static void tile(Monitor *); +@@ -234,6 +235,7 @@ + static void zoom(const Arg *arg); + + /* variables */ ++static Client *prevclient = NULL; + static const char broken[] = "broken"; + static char stext[256]; + static int screen; +@@ -1584,6 +1586,16 @@ + } + + void ++swapfocus(){ ++ Client *c; ++ for(c = selmon->clients; c && c != prevclient; c = c->next) ; ++ if(c == prevclient) { ++ focus(prevclient); ++ restack(prevclient->mon); ++ } ++} ++ ++void + tag(const Arg *arg) { + if(selmon->sel && arg->ui & TAGMASK) { + selmon->sel->tags = arg->ui & TAGMASK; +@@ -1675,6 +1687,7 @@ + unfocus(Client *c, Bool setfocus) { + if(!c) + return; ++ prevclient = c; + grabbuttons(c, False); + XSetWindowBorder(dpy, c->win, scheme[SchemeNorm].border->rgb); + if(setfocus) { +@@ -2033,12 +2046,13 @@ + void + zoom(const Arg *arg) { + Client *c = selmon->sel; ++ prevclient = nexttiled(selmon->clients); + + if(!selmon->lt[selmon->sellt]->arrange + || (selmon->sel && selmon->sel->isfloating)) + return; + if(c == nexttiled(selmon->clients)) +- if(!c || !(c = nexttiled(c->next))) ++ if(!c || !(c = prevclient = nexttiled(c->next))) + return; + pop(c); + } diff --git a/dwm.suckless.org/patches/swapfocus.md b/dwm.suckless.org/patches/swapfocus.md @@ -5,8 +5,9 @@ This patch makes it possible to switch focus with one single shortcut (alt-s) in ## 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-swapfocus.diff](dwm-6.1-swapfocus.diff) (1807b) (20140209) * [dwm-10e232f9ace7-swapfocus.diff](dwm-10e232f9ace7-swapfocus.diff) (1484b) (20120406) * [dwm-6.0-swapfocus.diff](dwm-6.0-swapfocus.diff) (1482b) (20120406) * [dwm-5.8.2-swap.diff](dwm-5.8.2-swap.diff) (dwm 5.8.2)