Hi there, as mentioned yesterday, I found a nice way how to
handle the geom stuff in the future.

In config.h one can now do:

DEFGEOM(single,  0,  0, sw,  0, bh, sw, sh-bh, wx, wy, 0.55*sw, \
        wh, mx+mw, wy, ww-mw, wh,  wx, wy, ww, wh)
DEFGEOM(dual,    0,  0,1280, 0, bh, ww, wh-bh, wx, wy, \
        1280,800-bh,  1280,  0, ww-mw, sh,  mx, my, mw, mh)


which will define a function at compile time called single(),
which sets all the geometry variables according to the input.
One can expect s{x,y,w,h} and bh being initialized, and they
can't be changed.

Besides this, in config.h you then define:

Geom geoms[] = {
        /* symbol       function */
        { "<>",         single },       /* first entry is default */
        { ")(",         dual },
};

This maps the single() head geometry to the "<>" string, and the
dual() head geometry to the ")(" string.

Then you can define key bindings like:

        { MODKEY, XK_a, setgeom, ")(" },
        { MODKEY, XK_d, setgeom, "<>" },

To grow/shrink the master area, you could reuse this approach as
follows:

DEFGEOM(growmaster, bx, by, bw, wx, wy, ww, wh, mx, my, \
        mw+=20, mh, tx, ty, tw-=20, th, mox, moy, mow, moh)
DEFGEOM(shrinkmaster, bx, by, bw, wx, wy, ww, wh, mx, my, \
        mw-=20, mh, tx, ty, tw+=20, th, mox, moy, mow, moh)

        { "+|",         growmaster },
        { "|-",         shrinkmaster },

        { MODKEY, XK_h, setgeom, "|-" },
        { MODKEY, XK_l, setgeom, "+|" },

Toggling the bar or bottom stack stuff works equivalently.

You can upgrade to hg tip, to check this new approach.

Kind regards,
-- 
 Anselm R. Garbe >< http://www.suckless.org/ >< GPG key: 0D73F361

Reply via email to