Re: [dwm] view all

From: Anselm R. Garbe <arg_AT_10kloc.org>
Date: Tue, 29 Aug 2006 10:11:31 +0200

On Mon, Aug 28, 2006 at 01:42:32PM -0400, Ross Mohn wrote:
> I find that a viewall() function is helpful for me. I map it to MODKEY_0
> on the keyboard and mouse Button2 when clicked on any tag in the status
> bar. I think others would find it useful in the main branch, too, but
> it's up to you.
>
> void
> viewall(Arg *arg)
> {
> unsigned int i;
>
> for(i = 0; i < ntags; i++)
> seltag[i] = True;
> arrange(NULL);
> }

I'd do this in a different way:

void
viewall(Arg *arg)
{
        static Bool active = False;
        static Bool *cache = False;
        unsigned int i;

        if(!cache)
                cache = emallocz(sizeof(Bool) * ntags);

        if((active = !active)) /* toggle */
                for(i = 0; i < ntags; i++)
                        cache[i] = seltag[i];

        for(i = 0; i < ntags; i++)
                seltag[i] = active ? active : cache[i];
        arrange(NULL);
}

Note, I didn't tested this...

Regards,

-- 
 Anselm R. Garbe  ><><  www.ebrag.de  ><><  GPG key: 0D73F361
Received on Tue Aug 29 2006 - 10:11:32 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 14:30:39 UTC