switchtag patch: do not switch tags if the tag is already shown, same with focusonnetactive patch

This commit is contained in:
bakkeby 2020-07-02 10:09:24 +02:00
parent 8120e0b858
commit 188f2f482f

10
dwm.c
View File

@ -668,8 +668,9 @@ applyrules(Client *c)
else
newtagset = c->tags;
if (newtagset) {
c->switchtag = selmon->tagset[selmon->seltags];
/* Switch to the client's tag, but only if that tag is not already shown */
if (newtagset && !(newtagset & c->mon->tagset[c->mon->seltags])) {
c->switchtag = c->mon->tagset[c->mon->seltags];
c->mon->tagset[c->mon->seltags] = newtagset;
if (r->switchtag == 1)
#if PERTAG_PATCH
@ -1167,6 +1168,10 @@ clientmessage(XEvent *e)
}
} else if (cme->message_type == netatom[NetActiveWindow]) {
#if FOCUSONNETACTIVE_PATCH
if (c->tags & c->mon->tagset[c->mon->seltags]) {
selmon = c->mon;
focus(c);
} else {
for (i = 0; i < LENGTH(tags) && !((1 << i) & c->tags); i++);
if (i < LENGTH(tags)) {
const Arg a = {.ui = 1 << i};
@ -1175,6 +1180,7 @@ clientmessage(XEvent *e)
focus(c);
restack(selmon);
}
}
#else
if (c != selmon->sel && !c->isurgent)
seturgent(c, 1);