From 8a4175eedad1e055ab05128afc3d5e0977d9b2db Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Tue, 26 Aug 2025 12:41:58 +0800 Subject: [PATCH] opt: optimize setmon logic --- src/mango.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mango.c b/src/mango.c index 21e71e5..3700441 100644 --- a/src/mango.c +++ b/src/mango.c @@ -1196,7 +1196,9 @@ void applyrules(Client *c) { } int fullscreen_state_backup = c->isfullscreen || client_wants_fullscreen(c); - setmon(c, mon, newtags, !c->isopensilent); + setmon(c, mon, newtags, + !c->isopensilent && (!c->istagsilent || !newtags || + newtags & mon->tagset[mon->seltags])); if (!c->isopensilent && (!c->istagsilent || c->tags & c->mon->tagset[c->mon->seltags]) && @@ -4333,7 +4335,7 @@ void setmon(Client *c, Monitor *m, unsigned int newtags, bool focus) { setfloating(c, c->isfloating); setfullscreen(c, c->isfullscreen); /* This will call arrange(c->mon) */ } - if (m && focus && (!c->istagsilent || c->tags & m->tagset[m->seltags])) + if (m && focus) focusclient(focustop(m), 1); if (!c->foreign_toplevel && m) {