fix: tagrule not apply correctly
This commit is contained in:
@@ -3165,33 +3165,37 @@ void reapply_master(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void parse_tagrule(Monitor *m) {
|
||||||
|
int i, jk;
|
||||||
|
|
||||||
|
for (i = 0; i < config.tag_rules_count; i++) {
|
||||||
|
|
||||||
|
if (config.tag_rules_count > 0 &&
|
||||||
|
(!config.tag_rules[i].monitor_name ||
|
||||||
|
regex_match(config.tag_rules[i].monitor_name,
|
||||||
|
m->wlr_output->name))) {
|
||||||
|
|
||||||
|
for (jk = 0; jk < LENGTH(layouts); jk++) {
|
||||||
|
if (config.tag_rules[i].layout_name &&
|
||||||
|
strcmp(layouts[jk].name, config.tag_rules[i].layout_name) ==
|
||||||
|
0) {
|
||||||
|
m->pertag->ltidxs[config.tag_rules[i].id] = &layouts[jk];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m->pertag->no_hide[config.tag_rules[i].id] =
|
||||||
|
config.tag_rules[i].no_hide;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void reapply_tagrule(void) {
|
void reapply_tagrule(void) {
|
||||||
Monitor *m = NULL;
|
Monitor *m = NULL;
|
||||||
int i, jk;
|
|
||||||
char *rule_monitor_name = NULL;
|
|
||||||
wl_list_for_each(m, &mons, link) {
|
wl_list_for_each(m, &mons, link) {
|
||||||
if (!m->wlr_output->enabled) {
|
if (!m->wlr_output->enabled) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
parse_tagrule(m);
|
||||||
// apply tag rule
|
|
||||||
for (i = 1; i <= config.tag_rules_count; i++) {
|
|
||||||
rule_monitor_name = config.tag_rules[i - 1].monitor_name;
|
|
||||||
if (regex_match(rule_monitor_name, m->wlr_output->name) ||
|
|
||||||
!rule_monitor_name) {
|
|
||||||
for (jk = 0; jk < LENGTH(layouts); jk++) {
|
|
||||||
if (config.tag_rules_count > 0 &&
|
|
||||||
config.tag_rules[i - 1].layout_name &&
|
|
||||||
strcmp(layouts[jk].name,
|
|
||||||
config.tag_rules[i - 1].layout_name) == 0) {
|
|
||||||
m->pertag->ltidxs[config.tag_rules[i - 1].id] =
|
|
||||||
&layouts[jk];
|
|
||||||
m->pertag->no_hide[config.tag_rules[i - 1].id] =
|
|
||||||
config.tag_rules[i - 1].no_hide;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
13
src/mango.c
13
src/mango.c
@@ -2705,18 +2705,7 @@ void createmon(struct wl_listener *listener, void *data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// apply tag rule
|
// apply tag rule
|
||||||
for (i = 1; i <= config.tag_rules_count; i++) {
|
parse_tagrule(m);
|
||||||
for (jk = 0; jk < LENGTH(layouts); jk++) {
|
|
||||||
if (config.tag_rules_count > 0 &&
|
|
||||||
config.tag_rules[i - 1].layout_name &&
|
|
||||||
strcmp(layouts[jk].name, config.tag_rules[i - 1].layout_name) ==
|
|
||||||
0) {
|
|
||||||
m->pertag->ltidxs[config.tag_rules[i - 1].id] = &layouts[jk];
|
|
||||||
m->pertag->no_hide[config.tag_rules[i - 1].id] =
|
|
||||||
config.tag_rules[i - 1].no_hide;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The xdg-protocol specifies:
|
/* The xdg-protocol specifies:
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user