Re: [dwm] Re: pertag patch

2009-01-03 Thread daniel fusser
2009/1/3 henry atting nspm...@literaturlatenight.de

 On Fr, Jan 02 2009, v4hn wrote:

 dwm.c:1743: error: redefinition of 'viewnext'
 dwm.c:1709: error: previous definition of 'viewnext' was here
 dwm.c:1760: error: redefinition of 'viewprevious'
 dwm.c:1726: error: previous definition of 'viewprevious' was here
 make: *** [dwm.o] Fehler 1

 As far as I see I have to decide for either the pertag or the arrownav
 patch, so I decided for the latter.

 Thanks
 henry



Hi,

I had the same problem some time ago but i managed to make them both work.

I removed the pertag variables in dwm.c and put them into my config.h where
I also put the viewnext() and viewprevious() functions. These two functions
have to be modified as well to make them work with the pertag patch
otherwise the values won't get stored when the function is called (which
means if you use the arrowkeys to change tags the pertag patch stuff has no
effect).

I can't remember what exactly caused the redefiniton errors but it works for
me this way...

It looks like this:

config.h
-


static int curtag = 1, prevtag = 1;
static Layout *lts[LENGTH(tags) + 1];
static double mfacts[LENGTH(tags) + 1];
static Bool showbars[LENGTH(tags) + 1];

static void viewnext(const Arg *arg);
static void viewprevious(const Arg *arg);

void
viewnext(const Arg *arg) {
unsigned int i, j;

for(i = 0; i  LENGTH(tags); i++) {
if((1  i  TAGMASK) == tagset[seltags]) {
seltags ^= 1;
if(i == LENGTH(tags) - 1)
tagset[seltags] = 1  0  TAGMASK;
else
tagset[seltags] = 1  (i + 1)  TAGMASK;
break;
}
}
/* * pertag support  * * * * * * * * * * * * * * * * * */
if(i  TAGMASK){
prevtag = curtag;
if(i == ~0)
curtag = 0;
else {
for (j=0; !(i  1  j); j++);
curtag = j + 1;
}
} else {
prevtag= curtag ^ prevtag;
curtag^= prevtag;
prevtag= curtag ^ prevtag;
}
lt[sellt]= lts[curtag];
mfact = mfacts[curtag];
if(showbar != showbars[curtag])
togglebar(NULL);
/* * * * * * * * * * * * * * * * * * * * * * * * * */
arrange();
}

void
viewprevious(const Arg *arg) {
unsigned int i, j;

for(i = 0; i  LENGTH(tags); i++) {
if((1  i  TAGMASK) == tagset[seltags]) {
seltags ^= 1;
if(i == 0)
tagset[seltags] = 1  (LENGTH(tags) - 1)  TAGMASK;
else
tagset[seltags] = 1  (i - 1)  TAGMASK;
break;
}
}
/* * pertag support  * * * * * * * * * * * * * * * * * */
if(i  TAGMASK){
prevtag = curtag;
if(i == ~0)
curtag = 0;
else {
for (j=0; !(i  1  j); j++);
curtag = j + 1;
}
} else {
prevtag= curtag ^ prevtag;
curtag^= prevtag;
prevtag= curtag ^ prevtag;
}
lt[sellt]= lts[curtag];
mfact = mfacts[curtag];
if(showbar != showbars[curtag])
togglebar(NULL);
/* * * * * * * * * * * * * * * * * * * * * * * * * */
 arrange();
 }


static Key keys[] = {
...
-


Re: [dwm] Re: pertag patch

2009-01-02 Thread v4hn
On Fri, Jan 02, 2009 at 06:12:45PM +0100, henry atting wrote:
 Mmh, I must have got it wrong. 
 I expected if I change the layout of one tag - let's say from tiled to
 bottomstack - it would not change the layout of all tags but only the
 current one.
 As far as I can see this is not what pertag does...

That's what it _should_ do and does for me.
What's the problem?


v4hn


pgpINg4ggs5k4.pgp
Description: PGP signature


Re: [dwm] Re: pertag patch

2009-01-02 Thread v4hn
On Fri, Jan 02, 2009 at 08:41:08PM +0100, henry atting wrote:
 Okay, I have three tags, suppose the layout of all is tiled. I switch to the
 third tag and change the layout to floating. As a result all three tags now
 have a floating layout.

I suppose you didn't apply the patch clean/at all(?).
Take a look at how to do so and give it another try.


v4hn


pgppjLIbflZxT.pgp
Description: PGP signature