commit: 50d953200c67f0de1272ccf457886c4d062d0066
parent: c9f843478056acb4c269ce89840e2649971f9a0a
author: Chris Noxz <chris@noxz.tech>
date: Tue, 4 Feb 2020 22:34:09 +0100
Implement emptyview
M | dwm.c | 23 | +++++++++++--------- |
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/dwm.c b/dwm.c
@@ -340,7 +340,10 @@ 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];
+ c->tags = c->tags & TAGMASK ? c->tags & TAGMASK
+ : c->mon->tagset[c->mon->seltags]
+ ? c->mon->tagset[c->mon->seltags]
+ : 1;
}
int
@@ -1672,7 +1675,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);
@@ -2178,28 +2181,28 @@ toggleview(const Arg *arg)
int i;
if (newtagset) {
- selmon->tagset[selmon->seltags] = newtagset;
if (newtagset == ~0) {
selmon->pertag->prevtag = selmon->pertag->curtag;
selmon->pertag->curtag = 0;
}
-
/* test if the user did not select the same tag */
if (!(newtagset & 1 << (selmon->pertag->curtag - 1))) {
selmon->pertag->prevtag = selmon->pertag->curtag;
- for (i = 0; !(newtagset & 1 << i); i++) ;
+ for (i = 0; !(newtagset & 1 << i); i++);
selmon->pertag->curtag = i + 1;
}
+ selmon->tagset[selmon->seltags] = newtagset;
/* apply settings for this view */
selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag];
selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag];
selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag];
selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt];
- selmon->lt[selmon->sellt^1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt^1];
-
- if (selmon->showbar != selmon->pertag->showbars[selmon->pertag->curtag])
- togglebar(NULL);
+ selmon->lt[selmon->sellt ^ 1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt^1];
+ focus(NULL);
+ arrange(selmon);
+ } else {
+ selmon->tagset[selmon->seltags] = newtagset;
focus(NULL);
arrange(selmon);
}
@@ -2497,7 +2500,7 @@ view(const Arg *arg)
int i;
unsigned int tmptag;
- 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) {