diff -up dwm-5.8.2/config.def.h dwm-5.8.2-swap/config.def.h --- dwm-5.8.2/config.def.h 2010-06-04 13:39:15.000000000 +0300 +++ dwm-5.8.2-swap/config.def.h 2011-01-26 07:53:44.607195598 +0200 @@ -53,6 +53,7 @@ static Key keys[] = { { MODKEY, XK_p, spawn, {.v = dmenucmd } }, { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, { MODKEY, XK_b, togglebar, {0} }, + { MODKEY, XK_s, swapfocus, {0} }, { MODKEY, XK_j, focusstack, {.i = +1 } }, { MODKEY, XK_k, focusstack, {.i = -1 } }, { MODKEY, XK_h, setmfact, {.f = -0.05} }, Only in dwm-5.8.2-swap: config.h diff -up dwm-5.8.2/dwm.c dwm-5.8.2-swap/dwm.c --- dwm-5.8.2/dwm.c 2010-06-04 13:39:15.000000000 +0300 +++ dwm-5.8.2-swap/dwm.c 2011-01-26 07:54:27.741193905 +0200 @@ -183,6 +183,7 @@ static void focus(Client *c); static void focusin(XEvent *e); static void focusmon(const Arg *arg); static void focusstack(const Arg *arg); +static void swapfocus(); static unsigned long getcolor(const char *colstr); static Bool getrootptr(int *x, int *y); static long getstate(Window w); @@ -244,6 +245,7 @@ static int xerrorstart(Display *dpy, XEr static void zoom(const Arg *arg); /* variables */ +static Arg focusdirection={.i=1}; static const char broken[] = "broken"; static char stext[256]; static int screen; @@ -862,6 +864,8 @@ focusmon(const Arg *arg) { void focusstack(const Arg *arg) { + focusdirection.i=arg->i; + Client *c = NULL, *i; if(!selmon->sel) @@ -886,6 +890,13 @@ focusstack(const Arg *arg) { } } +void +swapfocus(){ + focusdirection.i*=-1; + focusstack(&focusdirection); +} + + unsigned long getcolor(const char *colstr) { Colormap cmap = DefaultColormap(dpy, screen);