dwm-5.8.2-swap.diff (1898B)
1 diff -up dwm-5.8.2/config.def.h dwm-5.8.2-swap/config.def.h 2 --- dwm-5.8.2/config.def.h 2010-06-04 13:39:15.000000000 +0300 3 +++ dwm-5.8.2-swap/config.def.h 2011-01-26 07:53:44.607195598 +0200 4 @@ -53,6 +53,7 @@ static Key keys[] = { 5 { MODKEY, XK_p, spawn, {.v = dmenucmd } }, 6 { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, 7 { MODKEY, XK_b, togglebar, {0} }, 8 + { MODKEY, XK_s, swapfocus, {0} }, 9 { MODKEY, XK_j, focusstack, {.i = +1 } }, 10 { MODKEY, XK_k, focusstack, {.i = -1 } }, 11 { MODKEY, XK_h, setmfact, {.f = -0.05} }, 12 Only in dwm-5.8.2-swap: config.h 13 diff -up dwm-5.8.2/dwm.c dwm-5.8.2-swap/dwm.c 14 --- dwm-5.8.2/dwm.c 2010-06-04 13:39:15.000000000 +0300 15 +++ dwm-5.8.2-swap/dwm.c 2011-01-26 07:54:27.741193905 +0200 16 @@ -183,6 +183,7 @@ static void focus(Client *c); 17 static void focusin(XEvent *e); 18 static void focusmon(const Arg *arg); 19 static void focusstack(const Arg *arg); 20 +static void swapfocus(); 21 static unsigned long getcolor(const char *colstr); 22 static Bool getrootptr(int *x, int *y); 23 static long getstate(Window w); 24 @@ -244,6 +245,7 @@ static int xerrorstart(Display *dpy, XEr 25 static void zoom(const Arg *arg); 26 27 /* variables */ 28 +static Arg focusdirection={.i=1}; 29 static const char broken[] = "broken"; 30 static char stext[256]; 31 static int screen; 32 @@ -862,6 +864,8 @@ focusmon(const Arg *arg) { 33 34 void 35 focusstack(const Arg *arg) { 36 + focusdirection.i=arg->i; 37 + 38 Client *c = NULL, *i; 39 40 if(!selmon->sel) 41 @@ -886,6 +890,13 @@ focusstack(const Arg *arg) { 42 } 43 } 44 45 +void 46 +swapfocus(){ 47 + focusdirection.i*=-1; 48 + focusstack(&focusdirection); 49 +} 50 + 51 + 52 unsigned long 53 getcolor(const char *colstr) { 54 Colormap cmap = DefaultColormap(dpy, screen);