You are not logged in.
Hi everyone,
I am using dwm-5.8.2 with the pertag patch, and just applied the nmaster patch (I manually added the code from nmaster-sym.c to dwm.c so that it would work with pertag). The nmaster-sym.c patch states that it is for dwm-5.7.1, which I don't know if plays a role in the following "glitch."
Here is a description of the problem:
If I am in tag 1 and open up three windows with the layout ntile, I have two in master and one in stack by default (layout symbol shows "2]=" ). I then switch to tag 2 and open up three windows with the layout nbstack and make it so that there is only one window in master area (shows layout symbol "T1T" ). Now the weird thing is that if I switch back to tag one, it now only has one window in master (layout symbol is "1]=" ). So what is happening is that when I use nmaster and change the layout in one tag (i.e. the number of windows in master slot), it actually switches it to this configuration for all of the tags using either ntile or nbstack (makes them all have the same number of windows in the master stack as the current tag).
I hope that this makes sense, not sure how else to explain it. Please let me know if you need any additional clarification. Does anyone know how this issue could be fixed, as the pertag patch does state that it should work with nmaster? Besides this small issue, I have not had any other problems with pertag (e.g. with bstack, movestack).
This is the code from nmaster-sym.c that I added to dwm.c manually
enum {MaxMon = 8};
static int nmasters[MaxMon];
static int initnm = 0;
static void
initnmaster(void) {
int i;
if(initnm)
return;
for(i = 0; i < MaxMon; i++)
nmasters[i] = nmaster;
initnm = 1;
}
static void
incnmaster(const Arg *arg) {
if(!arg || !selmon->lt[selmon->sellt]->arrange || selmon->num >= MaxMon)
return;
nmasters[selmon->num] += arg->i;
if(nmasters[selmon->num] < 0)
nmasters[selmon->num] = 0;
arrange(selmon);
}
static void
setnmaster(const Arg *arg) {
if(!arg || !selmon->lt[selmon->sellt]->arrange || selmon->num >= MaxMon)
return;
nmasters[selmon->num] = arg->i > 0 ? arg->i : 0;
arrange(selmon);
}
static void
ntile(Monitor *m) {
int x, y, h, w, mw, nm;
unsigned int i, n;
Client *c;
initnmaster();
/* override layout symbol */
snprintf(m->ltsymbol, sizeof m->ltsymbol, "%d]=", nmasters[m->num]);
for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
c = nexttiled(m->clients);
nm = m->num < MaxMon ? nmasters[m->num] : nmaster;
if(nm > n)
nm = n;
/* master */
if(nm > 0) {
mw = m->mfact * m->ww;
h = m->wh / nm;
if(h < bh)
h = m->wh;
y = m->wy;
for(i = 0; i < nm; i++, c = nexttiled(c->next)) {
resize(c, m->wx, y, (n == nm ? m->ww : mw) - 2 * c->bw,
((i + 1 == nm) ? m->wy + m->wh - y : h) - 2 * c->bw, False);
if(h != m->wh)
y = c->y + HEIGHT(c);
}
n -= nm;
} else
mw = 0;
if(n == 0)
return;
/* tile stack */
x = m->wx + mw;
y = m->wy;
w = m->ww - mw;
h = m->wh / n;
if(h < bh)
h = m->wh;
for(i = 0; c; c = nexttiled(c->next), i++) {
resize(c, x, y, w - 2 * c->bw,
((i + 1 == n) ? m->wy + m->wh - y : h) - 2 * c->bw, False);
if(h != m->wh)
y = c->y + HEIGHT(c);
}
}
static void
nbstack(Monitor *m) {
int x, y, h, w, mh, nm;
unsigned int i, n;
Client *c;
initnmaster();
/* override layout symbol */
snprintf(m->ltsymbol, sizeof m->ltsymbol, "T%dT", nmasters[m->num]);
for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
c = nexttiled(m->clients);
nm = m->num < MaxMon ? nmasters[m->num] : nmaster;
if(nm > n)
nm = n;
/* master */
if(nm > 0) {
mh = m->mfact * m->wh;
w = m->ww / nm;
if(w < bh)
w = m->ww;
x = m->wx;
for(i = 0; i < nm; i++, c = nexttiled(c->next)) {
resize(c, x, m->wy, ((i + 1 == nm) ? m->wx + m->ww - x : w) - 2 * c->bw,
(n == nm ? m->wh : mh) - 2 * c->bw, False);
if(w != m->ww)
x = c->x + WIDTH(c);
}
n -= nm;
} else
mh = 0;
if(n == 0)
return;
/* tile stack */
x = m->wx;
y = m->wy + mh;
w = m->ww / n;
h = m->wh - mh;
if(w < bh)
w = m->ww;
for(i = 0; c; c = nexttiled(c->next), i++) {
resize(c, x, y, ((i + 1 == n) ? m->wx + m->ww - x : w) - 2 * c->bw,
h - 2 * c->bw, False);
if(w != m->ww)
x = c->x + WIDTH(c);
}
}
This was also added to config.h, as well as the layout symbols and key bindings.
static const int nmaster =2;
Thank you in advance.
Last edited by Novartum (2011-04-12 23:14:15)
Offline
Could anyone who uses pertag/nmaster with dwm offer an explanation of how they got it working? Does the nmaster-ncol.c patch work better (aimed at dwm-5.9)?
Offline
I recommend using the flextile patch instead.
It has nmaster, pertag, mirrorlayout and bottomstack built in and works really well (also with other patches).
Offline
Wow, after looking at your post, i realized that i too have this issue. I didn't notice it because i rarely use more than one window in the master area. And i am also using nmaster with pertag, and some other patches.
Offline
Vanvalium - thanks for the suggestion, but I would really like to just get nmaster working. I have everything set up just how I would like it now except for this small nuisance. I will look at flextile patch as a last resort.
Could anyone else who uses dwm confirm this issue or suggest how we could resolve it?
Offline
I am certain that there are more dwm users using pertag on this board Any advice?
Offline
So an update: I joined dwm mailing list and asked for help. It seems like nmaster is not compatible with pertag (it only saves one number for the # of windows in master, instead of a number for each tag). So flextile is probably the way to go.
Could vanvalium or anyone else explain how this patch works. I am not entirely clear from the patch info on dwm (http://dwm.suckless.org/patches/flextile). It doesnt seem like there is a command for each layout (e.g. ntile, nbstack, bstack,etc.), but that you rotate between layouts you choose to add (with ability to add or subtract windows from master)? Is this not a bit tedious, if I have understood the patch correctly?
Any clarification would be great.
Last edited by Novartum (2011-04-13 00:30:37)
Offline