diff -up dwm-4.3/config.default.h dwm-4.3-viewlast/config.default.h --- dwm-4.3/config.default.h 2007-07-14 20:11:29.000000000 +0100 +++ dwm-4.3-viewlast/config.default.h 2007-07-15 11:35:59.000000000 +0100 @@ -52,6 +52,7 @@ static Key key[] = { \ { MODKEY, XK_k, focusclient, "-1" }, \ { MODKEY, XK_m, togglemax, NULL }, \ { MODKEY, XK_Return, zoom, NULL }, \ + { MODKEY, XK_Tab, viewlast, NULL }, \ { MODKEY|ShiftMask, XK_space, togglefloating, NULL }, \ { MODKEY|ShiftMask, XK_c, killclient, NULL }, \ { MODKEY, XK_0, view, NULL }, \ Only in dwm-4.3-viewlast/: config.default.h.orig diff -up dwm-4.3/dwm.h dwm-4.3-viewlast/dwm.h --- dwm-4.3/dwm.h 2007-07-14 20:11:29.000000000 +0100 +++ dwm-4.3-viewlast/dwm.h 2007-07-15 11:37:37.000000000 +0100 @@ -87,6 +87,7 @@ extern unsigned int ntags, numlockmask; extern void (*handler[LASTEvent])(XEvent *); /* event handler */ extern Atom wmatom[WMLast], netatom[NetLast]; extern Bool selscreen, *seltag; /* seltag is array of Bool */ +extern unsigned int currenttag, lasttag; /* The last tag viewed */ extern Client *clients, *sel, *stack; /* global client list and stack */ extern Cursor cursor[CurLast]; extern DC dc; /* global draw context */ @@ -143,6 +144,7 @@ void settags(Client *c, Client *trans); void tag(const char *arg); /* tags sel with arg's index */ 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 viewlast(void); /* views the last viewed tag */ void view(const char *arg); /* views the tag with arg's index */ /* util.c */ Only in dwm-4.3-viewlast/: dwm.h.orig Only in dwm-4.3-viewlast/: dwm.h.rej diff -up dwm-4.3/main.c dwm-4.3-viewlast/main.c --- dwm-4.3/main.c 2007-07-14 20:11:29.000000000 +0100 +++ dwm-4.3-viewlast/main.c 2007-07-15 11:38:06.000000000 +0100 @@ -19,6 +19,7 @@ int screen, sx, sy, sw, sh, wax, way, wa unsigned int bh, ntags; unsigned int bpos = BARPOS; unsigned int numlockmask = 0; +unsigned int currenttag, lasttag; Atom wmatom[WMLast], netatom[NetLast]; Bool *seltag; Bool selscreen = True; @@ -183,6 +184,8 @@ setup(void) { sw = DisplayWidth(dpy, screen); sh = DisplayHeight(dpy, screen); initlayouts(); + currenttag = 0; + lasttag = 0; /* bar */ dc.h = bh = dc.font.height + 2; wa.override_redirect = 1; Only in dwm-4.3-viewlast/: main.c.orig Only in dwm-4.3-viewlast/: main.c.rej diff -up dwm-4.3/tag.c dwm-4.3-viewlast/tag.c --- dwm-4.3/tag.c 2007-07-14 20:11:29.000000000 +0100 +++ dwm-4.3-viewlast/tag.c 2007-07-15 11:35:59.000000000 +0100 @@ -140,13 +140,27 @@ toggleview(const char *arg) { } void +viewlast(void) { + char buf[32]; + snprintf(buf, sizeof buf, "%d", lasttag); + view(buf); + lt->arrange(); +} + +void view(const char *arg) { int i; for(i = 0; i < ntags; i++) seltag[i] = arg == NULL; i = arg ? atoi(arg) : 0; - if(i >= 0 && i < ntags) + if(i >= 0 && i < ntags) { seltag[i] = True; + + if (currenttag != i) { + lasttag = currenttag; + currenttag = i; + } + } lt->arrange(); } Only in dwm-4.3-viewlast/: tag.c.orig