Hello, I have a vague idea this has been discussed before, but since it was a simple patch, I wrote it anyway and you can do what you like with it. My main irratation with stock dwm* is that if you have multiple tags selected then when you create a window it will be tagged with all the currently selected tags. Personally I have a tag I'm working on primarily, but will swap other tags in and out as I work which contain specific window(s). This tag adds a mastertag variable which is used as follows: * initally tag 0 is the master tag. * new windows are tagged with mastertag only. * if you switch tag with view, that tag becomes the mastertag. * if you toggle the master tag off the lowest selected tag becomes master. This patch won't be for everybody, but I thought someone might have a use for it.
Regards, Archie *Apart from java, but my ire for that is fully aimed at sun
diff -r d6ca0f0dd71c dwm.h
--- a/dwm.h Tue Jan 16 12:38:08 2007 +0000
+++ b/dwm.h Tue Jan 16 12:41:15 2007 +0000
@@ -95,6 +95,7 @@ extern int wax, way, wah, waw; /* wind
extern int wax, way, wah, waw; /* windowarea geometry */
extern unsigned int master, nmaster; /* master percent, number of
master clients */
extern unsigned int ntags, numlockmask; /* number of tags,
dynamic lock mask */
+extern unsigned int mastertag; /* which tag is the current 'master'
tag */
extern void (*handler[LASTEvent])(XEvent *); /* event handler */
extern void (*arrange)(void); /* arrange function, indicates
mode */
extern Atom wmatom[WMLast], netatom[NetLast];
diff -r d6ca0f0dd71c main.c
--- a/main.c Tue Jan 16 12:38:08 2007 +0000
+++ b/main.c Tue Jan 16 12:41:15 2007 +0000
@@ -20,7 +20,7 @@ char stext[256];
char stext[256];
Bool *seltag;
int bh, bmw, screen, sx, sy, sw, sh, wax, way, waw, wah;
-unsigned int master, nmaster, ntags, numlockmask;
+unsigned int master, nmaster, ntags, numlockmask, mastertag;
Atom wmatom[WMLast], netatom[NetLast];
Bool running = True;
Bool issel = True;
@@ -120,6 +120,7 @@ setup(void) {
for(ntags = 0; tags[ntags]; ntags++);
seltag = emallocz(sizeof(Bool) * ntags);
seltag[0] = True;
+ mastertag = 0;
/* style */
dc.norm[ColBorder] = getcolor(NORMBORDERCOLOR);
dc.norm[ColBG] = getcolor(NORMBGCOLOR);
diff -r d6ca0f0dd71c tag.c
--- a/tag.c Tue Jan 16 12:38:08 2007 +0000
+++ b/tag.c Tue Jan 16 12:41:15 2007 +0000
@@ -103,7 +103,7 @@ settags(Client *c, Client *trans) {
}
if(!matched)
for(i = 0; i < ntags; i++)
- c->tags[i] = seltag[i];
+ c->tags[i] = mastertag == i;
}
void
diff -r d6ca0f0dd71c view.c
--- a/view.c Tue Jan 16 12:38:08 2007 +0000
+++ b/view.c Tue Jan 16 12:41:15 2007 +0000
@@ -225,9 +225,12 @@ toggleview(Arg *arg) {
unsigned int i;
seltag[arg->i] = !seltag[arg->i];
+
for(i = 0; i < ntags && !seltag[i]; i++);
if(i == ntags)
seltag[arg->i] = True; /* cannot toggle last view */
+ else
+ mastertag = (mastertag == arg->i) ? i : mastertag; /* check for new master
*/
arrange();
}
@@ -239,6 +242,7 @@ view(Arg *arg) {
seltag[i] = (arg->i == -1) ? True : False;
if(arg->i >= 0 && arg->i < ntags)
seltag[arg->i] = True;
+ mastertag = arg->i;
arrange();
}
pgpCGkPLBgbLU.pgp
Description: PGP signature
