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

20
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,13 +1168,18 @@ clientmessage(XEvent *e)
}
} else if (cme->message_type == netatom[NetActiveWindow]) {
#if FOCUSONNETACTIVE_PATCH
for (i = 0; i < LENGTH(tags) && !((1 << i) & c->tags); i++);
if (i < LENGTH(tags)) {
const Arg a = {.ui = 1 << i};
if (c->tags & c->mon->tagset[c->mon->seltags]) {
selmon = c->mon;
view(&a);
focus(c);
restack(selmon);
} else {
for (i = 0; i < LENGTH(tags) && !((1 << i) & c->tags); i++);
if (i < LENGTH(tags)) {
const Arg a = {.ui = 1 << i};
selmon = c->mon;
view(&a);
focus(c);
restack(selmon);
}
}
#else
if (c != selmon->sel && !c->isurgent)