Re: [dwm] cycling through tags?

From: Joerg van den Hoff <j.van_den_hoff_AT_fzd.de>
Date: Wed, 20 Feb 2008 21:34:20 +0100

andrew,

I think I owe you this feedback (coming a bit late for different reasons):
thanks again for your patch which does exactly what I had in mind. I added
the "prevtag" function as well:

 void
 goto_prevtag(const char *arg) {
       unsigned int i, j;
 
       memcpy(prevtags, seltags, sizeof seltags);
       for (i = 0; i < LENGTH(tags); i++) {
               if (seltags[i])
                       j = (i - 1 + LENGTH(tags)) % LENGTH(tags);
               seltags[i] = False;
       }
       seltags[j] = True;
       arrange();
 }

and I'm quite happy now after binding these functions to MODKEY plus
XK_comma and XK_period (a bit of `ion' heritage shining through here).
I would think your solution could be a useful patch for many people -- why
not make it available on the dwm homepage?

thanks again,

joerg

On Thu, Jan 31, 2008 at 10:02:18PM +0000, Andrew Oakley wrote:
> There is some question of what it would mean to move to the next tag
> when there are multiple tags selected. However, for a given definition
> of "next tag" it shouldn't be too hard to code.
>
> I don't think code like this should really be included in dwm - the
> question of what "next tag" means really is debatable, and people can
> easily hack it if they want.
>
> At the top of dwm.c, with the other declarations:
> void nexttag(const char *arg);
>
> Somewhere further down (doesn't really matter where) in dwm.c:
> void
> nexttag(const char *arg) {
> unsigned int i, j;
>
> memcpy(prevtags, seltags, sizeof seltags);
> for (i = 0; i < LENGTH(tags); i++) {
> if (seltags[i])
> j = (i + 1) % LENGTH(tags);
> seltags[i] = False;
> }
> seltags[j] = True;
> arrange();
> }
>
> In your config.h keybindings:
> { MODKEY, XK_n, nexttag, NULL },
>
> Obviously you would want to write a prevtag function as well, and
> probably make sure my code works (I can't say that I've actually tested
> it). In any case, this is the beauty of dwm - it really doesn't take
> long to hack it to do what you want.
>
> If the suggestion I've made doesn't work, I could do it properly, test,
> and post a patch if you like.
>
> Joerg van den Hoff wrote:
> > simple question:
> >
> > there seems to be no pre-defined way to cycle forward/backward
> > through tag-groups (still essentially a.k.a. workspaces to
> > me, though I understand there's a difference). only mod1+[1..9] and
> > mod1+tab seem to be in place for navigation. from my experience
> > with `ion' I find the cycling (next/previous) between workspaces most useful,
> > especially when searching for a certain window.
> >
> > question: can (and should) it be done?
> >
> > joerg
> >
> >
>
Received on Wed Feb 20 2008 - 21:34:21 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:20:49 UTC