diff -r cd9fd0986555 config.def.h
--- a/config.def.h	Mon May 19 20:29:57 2008 +0100
+++ b/config.def.h	Mon May 19 23:13:49 2008 +0200
@@ -42,6 +42,7 @@
 	{ MODKEY,                       XK_k,      focusprev,      NULL },
 	{ MODKEY,                       XK_h,      setmfact,       "-0.05" },
 	{ MODKEY,                       XK_l,      setmfact,       "+0.05" },
+	{ MODKEY,                       XK_m,      togglemax,       NULL },
 	{ MODKEY,                       XK_Return, zoom,           NULL },
 	{ MODKEY,                       XK_Tab,    viewprevtag,    NULL },
 	{ MODKEY|ShiftMask,             XK_c,      killclient,     NULL },
diff -r cd9fd0986555 dwm.c
--- a/dwm.c	Mon May 19 20:29:57 2008 +0100
+++ b/dwm.c	Mon May 19 23:13:49 2008 +0200
@@ -175,6 +175,7 @@
 void togglebar(const char *arg);
 void togglefloating(const char *arg);
 void togglelayout(const char *arg);
+void togglemax(const char *arg);
 void toggletag(const char *arg);
 void toggleview(const char *arg);
 void unban(Client *c);
@@ -198,6 +199,7 @@
 int screen, sx, sy, sw, sh;
 int bx, by, bw, bh, blw, wx, wy, ww, wh;
 int mx, my, mw, mh, tx, ty, tw, th;
+int rx, ry, rw, rh;
 int seltags = 0;
 int (*xerrorxlib)(Display *, XErrorEvent *);
 unsigned int numlockmask = 0;
@@ -216,10 +218,12 @@
 	[UnmapNotify] = unmapnotify
 };
 Atom wmatom[WMLast], netatom[NetLast];
+Bool domax = False;
 Bool otherwm, readin;
 Bool running = True;
 Bool *tagset[2];
 Client *clients = NULL;
+Client *rev = NULL;
 Client *sel = NULL;
 Client *stack = NULL;
 Cursor cursor[CurLast];
@@ -268,6 +272,7 @@
 arrange(void) {
 	Client *c;
 
+	focus(NULL);
 	for(c = clients; c; c = c->next)
 		if(isvisible(c)) {
 			unban(c);
@@ -277,8 +282,7 @@
 		else
 			ban(c);
 
-	focus(NULL);
-	if(lt->arrange)
+	if(lt->arrange && !domax)
 		lt->arrange();
 	restack();
 }
@@ -331,23 +335,23 @@
 				return;
 			}
 		}
-		if((ev->x < x + blw) && ev->button == Button1) 
-			togglelayout(NULL);
+		if(ev->x < x + blw) {
+			if(ev->button == Button1) 
+				togglelayout(NULL);
+			else if(ev->button == Button3)
+				togglemax(NULL);
+		}
 	}
-	else if((c = getclient(ev->window))) {
+	else if((c = getclient(ev->window)) && !domax) {
 		focus(c);
 		if(CLEANMASK(ev->state) != MODKEY)
 			return;
-		if(ev->button == Button1) {
-			restack();
+		if(ev->button == Button1)
 			movemouse(c);
-		}
 		else if(ev->button == Button2)
 			togglefloating(NULL);
-		else if(ev->button == Button3 && !c->isfixed) {
-			restack();
+		else if(ev->button == Button3 && !c->isfixed)
 			resizemouse(c);
-		}
 	}
 }
 
@@ -513,7 +517,7 @@
 	}
 	if(blw > 0) {
 		dc.w = blw;
-		drawtext(lt->symbol, dc.norm, False);
+		drawtext(lt->symbol, dc.norm, domax);
 		x = dc.x + dc.w;
 	}
 	else
@@ -607,15 +611,11 @@
 
 void
 enternotify(XEvent *e) {
-	Client *c;
 	XCrossingEvent *ev = &e->xcrossing;
 
-	if((ev->mode != NotifyNormal || ev->detail == NotifyInferior) && ev->window != root)
+	if(((ev->mode != NotifyNormal || ev->detail == NotifyInferior) && ev->window != root) || domax)
 		return;
-	if((c = getclient(ev->window)))
-		focus(c);
-	else
-		focus(NULL);
+	focus(getclient(ev->window));
 }
 
 void
@@ -640,11 +640,21 @@
 focus(Client *c) {
 	if(!c || (c && !isvisible(c)))
 		for(c = stack; c && !isvisible(c); c = c->snext);
+	if(rev)
+		resize(rev, rx, ry, rw, rh, resizehints | rev->isfloating);
 	if(sel && sel != c) {
 		grabbuttons(sel, False);
 		XSetWindowBorder(dpy, sel->win, dc.norm[ColBorder]);
 	}
 	if(c) {
+		if(domax) {
+			rx = c->x;
+			ry = c->y;
+			rw = c->w;
+			rh = c->h;
+			resize(c, wx, wy, ww - 2 * c->bw, wh - 2 * c->bw, resizehints);
+			rev = c;
+		}
 		detachstack(c);
 		attachstack(c);
 		grabbuttons(c, True);
@@ -1025,6 +1035,7 @@
 
 	ocx = nx = c->x;
 	ocy = ny = c->y;
+	restack();
 	if(XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
 	None, cursor[CurMove], CurrentTime) != GrabSuccess)
 		return;
@@ -1111,6 +1122,7 @@
 resize(Client *c, int x, int y, int w, int h, Bool sizehints) {
 	XWindowChanges wc;
 
+	rev = NULL;
 	if(sizehints) {
 		/* set minimum possible */
 		w = MAX(1, w);
@@ -1179,6 +1191,7 @@
 
 	ocx = c->x;
 	ocy = c->y;
+	restack();
 	if(XGrabPointer(dpy, root, False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
 	None, cursor[CurResize], CurrentTime) != GrabSuccess)
 		return;
@@ -1224,16 +1237,15 @@
 	drawbar();
 	if(!sel)
 		return;
-	if(sel->isfloating || !lt->arrange)
+	if(sel->isfloating || !lt->arrange || domax)
 		XRaiseWindow(dpy, sel->win);
-	if(lt->arrange) {
-		wc.stack_mode = Below;
+	if(lt->arrange && !domax) {
+		wc.stack_mode = Above;
 		wc.sibling = barwin;
-		for(c = stack; c; c = c->snext)
-			if(!c->isfloating && isvisible(c)) {
-				XConfigureWindow(dpy, c->win, CWSibling|CWStackMode, &wc);
-				wc.sibling = c->win;
-			}
+		for(c = nextunfloating(clients); c; c = nextunfloating(c->next)) {
+			XConfigureWindow(dpy, c->win, CWSibling|CWStackMode, &wc);
+			wc.sibling = c->win;
+		}
 	}
 	XSync(dpy, False);
 	while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
@@ -1571,6 +1583,13 @@
 		arrange();
 	else
 		drawbar();
+}
+
+void
+togglemax(const char *arg) {
+	domax = !domax;
+	focus(NULL);
+	restack();
 }
 
 void
