--- config.def.h Tue Sep 9 15:46:17 2008 +++ config.def.h Tue Nov 18 19:26:53 2008 @@ -61,6 +61,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 Tue Sep 9 15:46:17 2008 +++ dwm.c Tue Nov 18 19:31:55 2008 @@ -198,6 +198,8 @@ static void updatesizehints(Client *c); 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); @@ -1667,6 +1669,40 @@ view(const Arg *arg) { if(arg->ui & TAGMASK) tagset[seltags] = arg->ui & TAGMASK; clearurgent(); + 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(); }