Re: [dwm] idxoftag and tag names

From: Ali Gholami Rudi <aligrudi_AT_gmail.com>
Date: Sun, 11 Nov 2007 20:29:47 +0330

On Sun, Nov 11, 2007 at 05:26:38PM +0100, Anselm R. Garbe wrote:
> Actually it is intended that idxoftag() makes a pointer
> comparision, because it assumes that always the specific
> tags-array entry is used. I see no reason why one should do a
> string comparision which is more expensive and would lead to at
> least an additional waste of memory through allocating some
> extra space for "x" instead of re-using tags[3] for instance.

I use a variation of my prefixed_keys patch that I've submitted to
this mailing list some time ago (I use something like "C-; 1" for
viewing tag "1" and "C-; x" for viewing tag "x"). I have letter tags
as well as number tags and also I use a macro like this::

  #define TAGKEYS(name, key) \
    { 0, key, view, name }, \
    { ShiftMask, key, tag, name }, \
    { Mod1Mask, key, toggleview, name }, \
    { Mod1Mask|ShiftMask, key, toggletag, name }

    Key prefixedkeys[] = {
        TAGKEYS("1", XK_1),
        TAGKEYS("2", XK_2),
        /* ... */
        TAGKEYS("X", XK_x),
        TAGKEYS("P", XK_p),
        /* ... */
    }

(Note that prefixedkeys keys is activated after pressing the prefix.)

Using the name rather than tag index saves me finding the index and
updating them when I change the tags.

By the way, I've fixed my situation by patching my local repo so if no
one needs that it's not a problem.

Thanks,
-- Ali

Received on Sun Nov 11 2007 - 17:58:17 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:05:52 UTC