--- config.def.h Sat Dec 13 12:39:14 2008 +++ config.def.h Sat Dec 13 12:36:21 2008 @@ -62,6 +62,8 @@ static Key keys[] = { { MODKEY, XK_l, setmfact, {.f = +0.05} }, { MODKEY, XK_Return, zoom, {0} }, { MODKEY, XK_Tab, view, {0} }, + { MODKEY, XK_Right, viewnext, {0} }, + { MODKEY, XK_Left, viewprevious, {0} }, { MODKEY|ShiftMask, XK_c, killclient, {0} }, { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, --- dwm.c Sat Dec 13 12:39:15 2008 +++ dwm.c Sat Dec 13 12:38:48 2008 @@ -198,6 +198,8 @@ static void updatestatus(void); static void updatetitle(Client *c); static void updatewmhints(Client *c); static void view(const Arg *arg); +static void viewnext(const Arg *arg); +static void viewprevious(const Arg *arg); static int xerror(Display *dpy, XErrorEvent *ee); static int xerrordummy(Display *dpy, XErrorEvent *ee); static int xerrorstart(Display *dpy, XErrorEvent *ee); @@ -1631,6 +1633,40 @@ view(const Arg *arg) { seltags ^= 1; /* toggle sel tagset */ if(arg->ui & TAGMASK) tagset[seltags] = arg->ui & TAGMASK; + arrange(); +} + +void +viewnext(const Arg *arg) { + unsigned int i; + + for(i = 0; i < LENGTH(tags); i++) { + if((1 << i & TAGMASK) == tagset[seltags]) { + seltags ^= 1; + if(i == LENGTH(tags) - 1) + tagset[seltags] = 1 << 0 & TAGMASK; + else + tagset[seltags] = 1 << (i + 1) & TAGMASK; + break; + } + } + arrange(); +} + +void +viewprevious(const Arg *arg) { + unsigned int i; + + for(i = 0; i < LENGTH(tags); i++) { + if((1 << i & TAGMASK) == tagset[seltags]) { + seltags ^= 1; + if(i == 0) + tagset[seltags] = 1 << (LENGTH(tags) - 1) & TAGMASK; + else + tagset[seltags] = 1 << (i - 1) & TAGMASK; + break; + } + } arrange(); }