[dwm] a bottomstack and togglebar

From: Szabolcs Nagy <nszabolcs_AT_gmail.com>
Date: Tue, 13 May 2008 22:01:02 +0200

a possible bottomstack or togglebar for current tip with a modified updategeom()

showbar: bar is visible (or invisible)
topbar: bar position is at top (or bottom)
verticalsplit: master/stack split is vertical (or horizontal)
topleftmaster: master is on top/left (or bottom/right)

these can be macros in config.h so compiler can optimize away the ugly
conditions or can be ints so eg togglebar() can be implemented as
int showbar = 1;
void up(void) {updategeom(); updatebar(); arrange();}
void togglebar(const char *arg) {showbar = !showbar; up();}

void
updategeom(void) {
        /* bar geometry */
        bx = 0;
        by = showbar ? (topbar ? 0 : sh - bh) : -bh;
        bw = sw;

        /* window area geometry */
        wx = sx;
        wy = showbar && topbar ? sy + bh : sy;
        ww = sw;
        wh = showbar ? sh - bh : sh;

        /* master area geometry */
        mw = verticalsplit ? mfact * ww : ww;
        mh = verticalsplit ? wh : mfact * wh;
        mx = verticalsplit && !topleftmaster ? wx + ww - mw : wx;
        my = !verticalsplit && !topleftmaster ? wy + wh - mh : wy;

        /* tile area geometry */
        tx = verticalsplit && topleftmaster ? wx + mw : wx;
        ty = !verticalsplit && topleftmaster ? wy + mh : wy;
        tw = verticalsplit ? ww - mw : ww;
        th = verticalsplit ? wh : wh - mh;
}
Received on Tue May 13 2008 - 22:01:04 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:39:10 UTC