fix: windowrule option monitor apply error

This commit is contained in:
DreamMaoMao 2025-07-18 10:59:19 +08:00
parent 12fb6d57e2
commit 6f8be6faaa
2 changed files with 23 additions and 12 deletions

View file

@ -1092,7 +1092,6 @@ void applyrules(Client *c) {
/* rule matching */
const char *appid, *title;
unsigned int i, newtags = 0;
unsigned int mon_idx;
const ConfigWinRule *r;
Monitor *mon = selmon, *m;
Client *fc;
@ -1119,10 +1118,10 @@ void applyrules(Client *c) {
newtags |= (r->tags > 0) ? r->tags : 0;
// set monitor of client
mon_idx = 0;
wl_list_for_each(m, &mons, link) {
if (r->monitor == mon_idx++)
if (regex_match(r->monitor, m->wlr_output->name)) {
mon = m;
}
}
// set geometry of floating client
@ -1181,9 +1180,10 @@ void applyrules(Client *c) {
setmon(c, mon, newtags, !c->isopensilent);
if (!c->isopensilent && c->mon &&
!(c->tags & (1 << (c->mon->pertag->curtag - 1)))) {
((c->mon && c->mon != selmon) ||
!(c->tags & (1 << (c->mon->pertag->curtag - 1))))) {
c->animation.tag_from_rule = true;
view(&(Arg){.ui = c->tags}, true);
view_in_mon(&(Arg){.ui = c->tags}, true, c->mon);
}
setfullscreen(c, fullscreen_state_backup);