修复窗口默认 tag 错误 bug

This commit is contained in:
2025-08-23 23:03:05 +08:00
parent dfdc90e6c1
commit 505e2a5bcb
2 changed files with 6 additions and 6 deletions

View File

@@ -168,7 +168,7 @@ static void print_rule(const rule_t *r) {
bool2string(r->action.floating), bool2string(r->action.maximize),
bool2string(r->action.fullscreen),
bool2string(r->action.switch_to_tag));
for (uint32_t i = 0; r->tag && r->tag[i].monitor_amount; i++) {
for (uint32_t i = 0; r->tag && r->tag[i].tags; i++) {
const rule_tag_t *t = &r->tag[i];
printf("monitor amount: %u, monitor index: %u, tags: %b\n",
t->monitor_amount, t->monitor_index, t->tags);
@@ -583,11 +583,10 @@ void apply_rules(client_t *client) {
const rule_tag_t *tag = NULL;
for (uint32_t i = 0;; i++) {
const rule_tag_t *t = &r->tag[i];
if (!t->monitor_amount) break;
if (!t->tags) break;
if (t->monitor_amount == monitor_amount) {
if (!t->monitor_amount || t->monitor_amount == monitor_amount) {
tag = t;
break;
}
}
if (tag) {
@@ -597,6 +596,7 @@ void apply_rules(client_t *client) {
uint32_t tags_mask = get_tags_mask_of_monitor(m);
client->tags = tag->tags & tags_mask;
client->monitor = m;
}
}