修复窗口默认 tag 错误 bug
This commit is contained in:
@@ -54,7 +54,7 @@ const layout_t layouts[] = {
|
|||||||
|
|
||||||
/* 默认 tags 规则 */
|
/* 默认 tags 规则 */
|
||||||
const rule_tag_t browser_tag[] = {
|
const rule_tag_t browser_tag[] = {
|
||||||
{.monitor_amount = 1, .tags = 1 << 1},
|
{.monitor_index = 0, .tags = 1 << 1},
|
||||||
{0},
|
{0},
|
||||||
};
|
};
|
||||||
const rule_tag_t mpv_tag[] = {
|
const rule_tag_t mpv_tag[] = {
|
||||||
@@ -64,7 +64,7 @@ const rule_tag_t mpv_tag[] = {
|
|||||||
};
|
};
|
||||||
const rule_tag_t emacs_tag[] = {
|
const rule_tag_t emacs_tag[] = {
|
||||||
{.monitor_amount = 1, .monitor_index = 0, .tags = 1 << 2},
|
{.monitor_amount = 1, .monitor_index = 0, .tags = 1 << 2},
|
||||||
{.monitor_amount = 2, .monitor_index = 0, .tags = 1 << 1},
|
{.monitor_amount = 2, .monitor_index = 1, .tags = 1 << 1},
|
||||||
{0},
|
{0},
|
||||||
};
|
};
|
||||||
/* 新建窗口规则 */
|
/* 新建窗口规则 */
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ static void print_rule(const rule_t *r) {
|
|||||||
bool2string(r->action.floating), bool2string(r->action.maximize),
|
bool2string(r->action.floating), bool2string(r->action.maximize),
|
||||||
bool2string(r->action.fullscreen),
|
bool2string(r->action.fullscreen),
|
||||||
bool2string(r->action.switch_to_tag));
|
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];
|
const rule_tag_t *t = &r->tag[i];
|
||||||
printf("monitor amount: %u, monitor index: %u, tags: %b\n",
|
printf("monitor amount: %u, monitor index: %u, tags: %b\n",
|
||||||
t->monitor_amount, t->monitor_index, t->tags);
|
t->monitor_amount, t->monitor_index, t->tags);
|
||||||
@@ -583,11 +583,10 @@ void apply_rules(client_t *client) {
|
|||||||
const rule_tag_t *tag = NULL;
|
const rule_tag_t *tag = NULL;
|
||||||
for (uint32_t i = 0;; i++) {
|
for (uint32_t i = 0;; i++) {
|
||||||
const rule_tag_t *t = &r->tag[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;
|
tag = t;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (tag) {
|
if (tag) {
|
||||||
@@ -597,6 +596,7 @@ void apply_rules(client_t *client) {
|
|||||||
|
|
||||||
uint32_t tags_mask = get_tags_mask_of_monitor(m);
|
uint32_t tags_mask = get_tags_mask_of_monitor(m);
|
||||||
client->tags = tag->tags & tags_mask;
|
client->tags = tag->tags & tags_mask;
|
||||||
|
client->monitor = m;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user