Re: [dwm] Updated bottom stack patch

From: Anselm R. Garbe <arg_AT_suckless.org>
Date: Sun, 16 Sep 2007 13:18:24 +0200

Hi James,

cool, I want to give an example how your patch should be
reorganized that it works with less of a hassle beginning with dwm-4.5:

Imagine bstack.c:
/* by James */
static void
bstack(void) {
        unsigned int i, n, nx, ny, nw, nh, mh, tw, th;
        Client *c;

        for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
                n++;

        /* window geoms */
        mh = (n > 1) ? (wah * mwfact) / 1 : wah / (n > 0 ? n : 1);
        th = (n > 1) ? (wah * (1 - mwfact)) / 1 : 0;
        tw = (n > 1) ? waw / (n - 1) : 0;

        for(i = 0, c = nexttiled(clients); c; c = nexttiled(c->next), i++) {
                c->ismax = False;
                nx = wax;
                ny = way;
                if(i < 1) {
                        ny += i * mh;
                        nw = waw - 2 * c->border;
                        nh = mh - 2 * c->border;
                }
                else {
                        nx += (i - 1) * tw;
                        ny += mh * 1;
                        if(i + 1 == n) { /* remainder */
                                nw = (wax + waw) - nx - 2 * c->border;
                        }
                        else {
                                nw = tw - 2 * c->border;
                        }
                        nh = th - 2 * c->border + 1;
                }
                resize(c, nx, ny, nw, nh, RESIZEHINTS);
        }
}

static void
bzoom(const char *arg) {
        Client *c;
 
        if(!sel || (!isarrange(tile) && !isarrange(bstack)) || sel->isfloating)
                return;
        if((c = sel) == nexttiled(clients))
                if(!(c = nexttiled(c->next)))
                        return;
        detach(c);
        attach(c);
        focus(c);
        arrange();
}
EOF

And imagine the following config.h.diff

 /* layout(s) */
+#include "bstack.c"
 static Layout layouts[] = {
         /* symbol function */
         { "[]=", tile }, /* first entry is default */
         { "><>", floating },
+ { "TTT", bstack},
 };
 #define RESIZEHINTS True /* False - respect size hints in tiled resizals */
 #define MWFACT 0.6 /* master width factor [0.1 .. 0.9] */
@@ -48,7 +50,7 @@ Key keys[] = { \
         { MODKEY, XK_h, setmwfact, "-0.05" }, \
         { MODKEY, XK_l, setmwfact, "+0.05" }, \
         { MODKEY, XK_m, togglemax, NULL }, \
- { MODKEY, XK_Return, zoom, NULL }, \
+ { MODKEY, XK_Return, bzoom, NULL }, \
         { MODKEY|ShiftMask, XK_space, togglefloating, NULL }, \
         { MODKEY|ShiftMask, XK_c, killclient, NULL }, \
         { MODKEY, XK_0, view, NULL }, \

As you see, no patches necessary at all, except including that
bstack.c file and to changing the zoom call with bzoom.

Regards,

-- 
 Anselm R. Garbe >< http://www.suckless.org/ >< GPG key: 0D73F361
Received on Sun Sep 16 2007 - 13:18:24 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 14:53:09 UTC