Re: [dev] [dwm] switch tag with mouse wheel on root

2010-12-21 Thread David Demelier

On 21/12/2010 14:14, Rob wrote:

dwm doesn't have this by default, because dwm doesn't have a "current
tag", since you can have many activated.
Here's what I do [attached]. It's taken and modified from a ML post I
saw a good while back.

Rob.



Absolutely great! Thanks, this little piece of code should be added to 
the patches/ :-).


Kind regards,

David.



Re: [dev] [dwm] switch tag with mouse wheel on root

2010-12-21 Thread Rob
dwm doesn't have this by default, because dwm doesn't have a "current
tag", since you can have many activated.
Here's what I do [attached]. It's taken and modified from a ML post I
saw a good while back.

Rob.

On 21 December 2010 11:07, David Demelier  wrote:
> Hello dear dwm users,
>
> I was just wondering how could I switch to the next or previous tag by using
> the mouse wheel on root window.
>
> I think I must add the following :
>
> { ClkRootWin,            MODKEY,         Button4, ?? }
> { ClkRootWin,            MODKEY,         Button5, ?? }
>
> But I don't know what I must add in the argument colon.
>
> Kind regards,
>
> --
> David Demelier
>
>
void
view_adjacent(const Arg *arg)
{
	int i, curtags;
	int seltag = 0;
	Arg a;

	curtags = selmon->tagset[selmon->seltags];
	for(i = 0; i < LENGTH(tags); i++)
		if(curtags & (1 << i)){
			seltag = i;
			break;
		}

	seltag = (seltag + arg->i) % (int)LENGTH(tags);
	if(seltag < 0)
		seltag += LENGTH(tags);

	a.i = (1 << seltag);
	view(&a);
}
static Key keys[] = {
	/* ... */
	{ MODKEY,  XK_l,   view_adjacent,  { .i = +1 } },
	{ MODKEY,  XK_h,   view_adjacent,  { .i = -1 } },
	/* ... */
};

static Button buttons[] = {
	/* ... */
	{ ClkTagBar,0,  Button4,view_adjacent, { .i = -1 } },
	{ ClkTagBar,0,  Button5,view_adjacent, { .i = +1 } },
	/* ... */
};



[dev] [dwm] switch tag with mouse wheel on root

2010-12-21 Thread David Demelier

Hello dear dwm users,

I was just wondering how could I switch to the next or previous tag by 
using the mouse wheel on root window.


I think I must add the following :

{ ClkRootWin,MODKEY, Button4, ?? }
{ ClkRootWin,MODKEY, Button5, ?? }

But I don't know what I must add in the argument colon.

Kind regards,

--
David Demelier