commit 75c9db501282ee76cd0a2ba46fcaa3d3b88d79bb
parent f81790e6aeb3b5a2545d26b91dd880d20a29a60c
Author: Jan Christoph Ebersbach <jceb@e-jc.de>
Date: Tue, 14 Feb 2012 21:28:03 +0100
update swapfocs patch to dwm 6.0
Diffstat:
2 files changed, 54 insertions(+), 1 deletion(-)
diff --git a/dwm.suckless.org/patches/dwm-6.0-swapfocus.diff b/dwm.suckless.org/patches/dwm-6.0-swapfocus.diff
@@ -0,0 +1,52 @@
+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.
+
+diff -r 6f54bd1ef439 dwm.c
+--- a/dwm.c Wed Jan 04 13:30:12 2012 +0100
++++ b/dwm.c Sun Feb 12 09:32:52 2012 +0100
+@@ -224,6 +224,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 int textnw(const char *text, unsigned int len);
+@@ -253,6 +254,7 @@
+ static void zoom(const Arg *arg);
+
+ /* variables */
++static Client *prevclient = NULL;
+ static const char broken[] = "broken";
+ static char stext[256];
+ static int screen;
+@@ -926,6 +928,11 @@
+ return atom;
+ }
+
++void
++swapfocus(){
++ focus(prevclient);
++}
++
+ unsigned long
+ getcolor(const char *colstr) {
+ Colormap cmap = DefaultColormap(dpy, screen);
+@@ -1775,6 +1782,7 @@
+ unfocus(Client *c, Bool setfocus) {
+ if(!c)
+ return;
++ prevclient = c;
+ grabbuttons(c, False);
+ XSetWindowBorder(dpy, c->win, dc.norm[ColBorder]);
+ if(setfocus)
+@@ -2116,6 +2124,7 @@
+ void
+ zoom(const Arg *arg) {
+ Client *c = selmon->sel;
++ prevclient = selmon->clients;
+
+ if(!selmon->lt[selmon->sellt]->arrange
+ || (selmon->sel && selmon->sel->isfloating))
diff --git a/dwm.suckless.org/patches/swapfocus.md b/dwm.suckless.org/patches/swapfocus.md
@@ -6,9 +6,10 @@ This patch makes it possible to switch focus with one single shortcut (alt-s) in
## Download
+ * [dwm-6.0-swapfocus.diff](dwm-6.0-swapfocus.diff) (dwm 6.0)
* [dwm-5.8.2-swap.diff](dwm-5.8.2-swap.diff) (dwm 5.8.2)
## Author
* Lasse Engblom
-
+ * Jan Christoph Ebersbach