On Sat, Jun 13, 2009 at 12:14 PM, Szabolcs Nagy<nszabo...@gmail.com> wrote: > On 6/13/09, Thanos Zygouris <thanos.zygou...@gmail.com> wrote: >> I use dwm-5.3.1 some time now and i really love the "gapless grid" layout >> and the "save floats" patch. >> I recently tried to upgrade to dwm-5.5, but it seems that the "save floats" >> patch is no longer compatible... >> The official page states that "it has recently become part of the main dwm >> distribution", but when i installed the 5.5 version, >> no "save float" seems to exist... >> Do i miss something here? Can anyone help me out? > > save floats wasn't added > i removed that statement from the wiki > > adapting the old patch should be easy > >
Here you go. I adapted it for myself the other day. Feel free to add it to the wiki or whatever.
Saves the size of floating windows. This also means that the first time you float a window, it will change back to the initially requested size, which is useful for badly behaving applications. --- a/dwm.c +++ b/dwm.c @@ -83,6 +83,7 @@ struct Client { char name[256]; float mina, maxa; int x, y, w, h; + int sx, sy, sw, sh; int basew, baseh, incw, inch, maxw, maxh, minw, minh; int bw, oldbw; unsigned int tags; @@ -945,6 +946,10 @@ manage(Window w, XWindowAttributes *wa) XSetWindowBorder(dpy, w, dc.norm[ColBorder]); configure(c); /* propagates border_width, if size doesn't change */ updatesizehints(c); + c->sx = c->x; + c->sy = c->y; + c->sw = c->w; + c->sh = c->h; XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask); grabbuttons(c, False); updatetitle(c); @@ -1101,6 +1106,12 @@ resize(Client *c, int x, int y, int w, i c->y = wc.y = y; c->w = wc.width = w; c->h = wc.height = h; + if (!lt[sellt]->arrange || c->isfloating) { + c->sx = x; + c->sy = y; + c->sw = w; + c->sh = h; + } wc.border_width = c->bw; XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc); @@ -1331,7 +1342,9 @@ showhide(Client *c) { return; if(ISVISIBLE(c)) { /* show clients top down */ XMoveWindow(dpy, c->win, c->x, c->y); - if(!lt[sellt]->arrange || c->isfloating) + if(!lt[sellt]->arrange && !c->isfloating) + resize(c, c->sx, c->sy, c->sw, c->sh); + else if (c->isfloating) resize(c, c->x, c->y, c->w, c->h); showhide(c->snext); } @@ -1428,7 +1441,13 @@ togglefloating(const Arg *arg) { return; sel->isfloating = !sel->isfloating || sel->isfixed; if(sel->isfloating) - resize(sel, sel->x, sel->y, sel->w, sel->h); + resize(sel, sel->sx, sel->sy, sel->sw, sel->sh); + else { + sel->sx = sel->x; + sel->sy = sel->y; + sel->sw = sel->w; + sel->sh = sel->h; + } arrange(); }