diff -up dwm-3.4/client.c dwm-3.4-save-floats/client.c --- dwm-3.4/client.c 2007-02-07 06:42:14.000000000 -0500 +++ dwm-3.4-save-floats/client.c 2007-02-11 11:31:10.000000000 -0500 @@ -174,6 +174,10 @@ manage(Window w, XWindowAttributes *wa) c->y = way; } updatesizehints(c); + c->sfx = c->x; + c->sfy = c->y; + c->sfw = c->w; + c->sfh = c->h; XSelectInput(dpy, c->win, StructureNotifyMask | PropertyChangeMask | EnterWindowMask); XGetTransientForHint(dpy, c->win, &trans); @@ -259,6 +263,15 @@ resize(Client *c, Bool sizehints) { wc.border_width = c->border; XConfigureWindow(dpy, c->win, CWX | CWY | CWWidth | CWHeight | CWBorderWidth, &wc); configure(c); + + if(arrange == dofloat || c->isfloat) { + /*store float dimensions*/ + c->sfx = c->x; + c->sfy = c->y; + c->sfw = c->w; + c->sfh = c->h; + } + XSync(dpy, False); } Only in dwm-3.4: client.o Only in dwm-3.4: config.h Only in dwm-3.4: draw.o Only in dwm-3.4: dwm diff -up dwm-3.4/dwm.h dwm-3.4-save-floats/dwm.h --- dwm-3.4/dwm.h 2007-02-07 06:42:14.000000000 -0500 +++ dwm-3.4-save-floats/dwm.h 2007-02-11 11:42:54.000000000 -0500 @@ -69,6 +69,7 @@ struct Client { char name[256]; int x, y, w, h; int rx, ry, rw, rh; /* revert geometry */ + int sfx, sfy, sfw, sfh; /* stored float geometry, used on mode revert */ int basew, baseh, incw, inch, maxw, maxh, minw, minh; int minax, minay, maxax, maxay; long flags; @@ -90,6 +91,7 @@ extern unsigned int master, nmaster; /* extern unsigned int ntags, numlockmask; /* number of tags, dynamic lock mask */ extern void (*handler[LASTEvent])(XEvent *); /* event handler */ extern void (*arrange)(void); /* arrange function, indicates mode */ +extern Bool modeswitch; /* mode has been toggled */ extern Atom wmatom[WMLast], netatom[NetLast]; extern Bool running, selscreen, *seltag; /* seltag is array of Bool */ extern Client *clients, *sel, *stack; /* global client list and stack */ Only in dwm-3.4: event.o Only in dwm-3.4: main.o Only in dwm-3.4: tag.o Only in dwm-3.4: util.o diff -up dwm-3.4/view.c dwm-3.4-save-floats/view.c --- dwm-3.4/view.c 2007-02-07 06:42:14.000000000 -0500 +++ dwm-3.4-save-floats/view.c 2007-02-11 11:31:07.000000000 -0500 @@ -38,6 +38,7 @@ togglemax(Client *c) { /* extern */ void (*arrange)(void) = DEFMODE; +Bool modeswitch = 0; void detach(Client *c) { @@ -55,6 +56,15 @@ dofloat(void) { Client *c; for(c = clients; c; c = c->next) { + + if(modeswitch) { + /*restore last known float dimensions*/ + c->x = c->sfx; + c->y = c->sfy; + c->w = c->sfw; + c->h = c->sfh; + } + if(isvisible(c)) { resize(c, True); } @@ -216,10 +226,12 @@ togglefloat(Arg *arg) { void togglemode(Arg *arg) { arrange = (arrange == dofloat) ? dotile : dofloat; + modeswitch = 1; if(sel) arrange(); else drawstatus(); + modeswitch = 0; } void Only in dwm-3.4: view.o