diff -up dwm-4.4/config.default.h dwm-4.4-prevtags/config.default.h --- dwm-4.4/config.default.h 2007-08-23 18:11:41.000000000 +0200 +++ dwm-4.4-prevtags/config.default.h 2007-08-23 23:34:46.000000000 +0200 @@ -52,6 +52,7 @@ Key keys[] = { \ { MODKEY, XK_Return, zoom, NULL }, \ { MODKEY|ShiftMask, XK_space, togglefloating, NULL }, \ { MODKEY|ShiftMask, XK_c, killclient, NULL }, \ + { MODKEY, XK_Escape, viewprevtag, NULL }, \ { MODKEY, XK_0, view, NULL }, \ { MODKEY, XK_1, view, tags[0] }, \ { MODKEY, XK_2, view, tags[1] }, \ diff -up dwm-4.4/dwm.h dwm-4.4-prevtags/dwm.h --- dwm-4.4/dwm.h 2007-08-23 18:11:41.000000000 +0200 +++ dwm-4.4-prevtags/dwm.h 2007-08-23 23:30:34.000000000 +0200 @@ -81,7 +81,7 @@ extern unsigned int bh, blw, bpos; /* b extern unsigned int ntags, numlockmask; /* number of tags, numlock mask */ extern void (*handler[LASTEvent])(XEvent *); /* event handler */ extern Atom wmatom[WMLast], netatom[NetLast]; -extern Bool selscreen, *seltags; /* seltags is array of Bool */ +extern Bool selscreen, *seltags, *prevtags; /* seltags is array of Bool */ extern Client *clients, *sel, *stack; /* global client list and stack */ extern Cursor cursor[CurLast]; extern DC dc; /* global draw context */ @@ -139,6 +139,7 @@ void toggletag(const char *arg); /* togg void toggleview(const char *arg); /* toggles the tag with arg's index (in)visible */ void updatebarpos(void); /* updates the bar position */ void view(const char *arg); /* views the tag with arg's index */ +void viewprevtag(const char *arg); /* views previous selected tags */ /* util.c */ void *emallocz(unsigned int size); /* allocates zero-initialized memory, exits on error */ diff -up dwm-4.4/main.c dwm-4.4-prevtags/main.c --- dwm-4.4/main.c 2007-08-23 18:11:41.000000000 +0200 +++ dwm-4.4-prevtags/main.c 2007-08-23 23:40:09.000000000 +0200 @@ -21,7 +21,7 @@ unsigned int bh, ntags; unsigned int bpos = BARPOS; unsigned int numlockmask = 0; Atom wmatom[WMLast], netatom[NetLast]; -Bool *seltags; +Bool *seltags, *prevtags; Bool selscreen = True; Client *clients = NULL; Client *sel = NULL; @@ -58,6 +58,7 @@ cleanup(void) { XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime); XSync(dpy, False); free(seltags); + free(prevtags); } static unsigned long @@ -196,7 +197,9 @@ setup(void) { compileregs(); for(ntags = 0; tags[ntags]; ntags++); seltags = emallocz(sizeof(Bool) * ntags); + prevtags = emallocz(sizeof(Bool) * ntags); seltags[0] = True; + prevtags[0] = True; /* style */ dc.norm[ColBorder] = initcolor(NORMBORDERCOLOR); dc.norm[ColBG] = initcolor(NORMBGCOLOR); diff -up dwm-4.4/screen.c dwm-4.4-prevtags/screen.c --- dwm-4.4/screen.c 2007-08-23 18:11:41.000000000 +0200 +++ dwm-4.4-prevtags/screen.c 2007-08-23 23:30:57.000000000 +0200 @@ -367,10 +367,25 @@ void view(const char *arg) { unsigned int i; - for(i = 0; i < ntags; i++) + for(i = 0; i < ntags; i++) { + prevtags[i] = seltags[i]; seltags[i] = arg == NULL; + } i = idxoftag(arg); if(i >= 0 && i < ntags) seltags[i] = True; arrange(); } + +void +viewprevtag(const char *arg) { + unsigned int i; + Bool t; + + for(i = 0; i < ntags; i++) { + t = seltags[i]; + seltags[i] = prevtags[i]; + prevtags[i] = t; + } + arrange(); +}