diff --git a/dwm.c b/dwm.c index 1d78655..a526e57 100644 --- a/dwm.c +++ b/dwm.c @@ -322,7 +322,9 @@ applyrules(Client *c) { XFree(ch.res_class); if(ch.res_name) XFree(ch.res_name); - c->tags = c->tags & TAGMASK ? c->tags & TAGMASK : c->mon->tagset[c->mon->seltags]; + if(c->tags & TAGMASK) c->tags = c->tags & TAGMASK; + else if(c->mon->tagset[c->mon->seltags]) c->tags = c->mon->tagset[c->mon->seltags]; + else c->tags = 1; } Bool @@ -649,7 +651,7 @@ createmon(void) { if(!(m = (Monitor *)calloc(1, sizeof(Monitor)))) die("fatal: could not malloc() %u bytes\n", sizeof(Monitor)); - m->tagset[0] = m->tagset[1] = 1; + m->tagset[0] = m->tagset[1] = 0; m->mfact = mfact; m->nmaster = nmaster; m->showbar = showbar; @@ -1479,7 +1481,7 @@ sendmon(Client *c, Monitor *m) { detach(c); detachstack(c); c->mon = m; - c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */ + c->tags = (m->tagset[m->seltags] ? m->tagset[m->seltags] : 1); attach(c); attachstack(c); focus(NULL); @@ -1763,12 +1765,9 @@ toggletag(const Arg *arg) { void toggleview(const Arg *arg) { unsigned int newtagset = selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK); - - if(newtagset) { - selmon->tagset[selmon->seltags] = newtagset; - focus(NULL); - arrange(selmon); - } + selmon->tagset[selmon->seltags] = newtagset; + focus(NULL); + arrange(selmon); } void @@ -2043,7 +2042,7 @@ updatewmhints(Client *c) { void view(const Arg *arg) { - if((arg->ui & TAGMASK) == selmon->tagset[selmon->seltags]) + if(arg->ui && (arg->ui & TAGMASK) == selmon->tagset[selmon->seltags]) return; selmon->seltags ^= 1; /* toggle sel tagset */ if(arg->ui & TAGMASK) -- 1.8.2