Re: [dwm] [patch] nmaster for dwm 4.5

From: Chris Webb <chris_AT_arachsys.com>
Date: Fri, 21 Sep 2007 19:34:40 +0100

Peter Hartlich <sgkkr_AT_hartlich.com> writes:

> Attached is Jeroen Schot's nmaster patch, "ported" to dwm (pre-)4.5 and
> with incnmaster() renamed setnmaster().
[...]
> void
> setnmaster(const char *arg) {
> int i;
>
> if(!isarrange(tile))
> return;
> if(!arg)
> nmaster = NMASTER;
> else {
> i = atoi(arg);
> if((nmaster + i) < 1 || wah / (nmaster + i) <= 2 * BORDERPX)
> return;
> nmaster += i;
> }
> if(sel)
> arrange();
> else
> drawbar();
> }
>

For setnmaster to behave consistently with setmwfact (which takes an
absolute value or a delta beginning with + or -), you might prefer
something like

void
setnmaster(const char *arg) {
        int i;
        if(!isarrange(tile))
                return;
        if(!arg)
                nmaster = NMASTER;
        else {
                if(arg[0] != '+' && arg[0] != '-')
                        i = atoi(arg);
                else
                        i = nmaster + atoi(arg);
                 if(i < 1 || wah / i <= 2 * BORDERPX)
                        return;
                nmaster = i;
        }
        if(sel)
                arrange();
        else
                drawbar();
}

Best wishes,

Chris.
Received on Fri Sep 21 2007 - 20:34:42 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 14:54:12 UTC