diff -r 17545de77bcb dwm.h --- a/dwm.h Sun Jul 22 16:45:45 2007 +0200 +++ b/dwm.h Sun Jul 22 16:50:54 2007 +0200 @@ -144,6 +144,7 @@ void toggletag(const char *arg); /* togg void toggletag(const char *arg); /* toggles sel tags with arg's index */ void toggleview(const char *arg); /* toggles the tag with arg's index (in)visible */ void view(const char *arg); /* views the tag with arg's index */ +void selecttag(const char *arg); /* select next(1) / previous(-1) tag */ /* util.c */ void *emallocz(unsigned int size); /* allocates zero-initialized memory, exits on error */ diff -r 17545de77bcb event.c --- a/event.c Sun Jul 22 16:45:45 2007 +0200 +++ b/event.c Sun Jul 22 16:50:54 2007 +0200 @@ -135,6 +135,10 @@ buttonpress(XEvent *e) { else toggleview(buf); } + else if ( ev->button == Button4 ) + selecttag("-1"); + else if ( ev->button == Button5 ) + selecttag("1"); return; } } diff -r 17545de77bcb tag.c --- a/tag.c Sun Jul 22 16:45:45 2007 +0200 +++ b/tag.c Sun Jul 22 16:50:54 2007 +0200 @@ -150,3 +150,20 @@ view(const char *arg) { seltag[i] = True; lt->arrange(); } + +void +selecttag(const char *arg) { + int i; + for (i = 0; i < ntags; i++) { + if ( seltag[i] ) { + seltag[i] = False; + i += (arg ? atoi(arg) : 1); + if ( i < 0) i = ntags - 1; + if ( i >= ntags) i = 0; + seltag[i] = True; + lt->arrange(); + return; + } + } +} +