mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2025-10-29 05:40:21 -04:00
opt: optimize reload config code struct
This commit is contained in:
parent
3c1c90cf5b
commit
11186dd498
1 changed files with 30 additions and 14 deletions
|
|
@ -2584,10 +2584,12 @@ void reapply_monitor_rules(void) {
|
|||
|
||||
mr = &config.monitor_rules[ji];
|
||||
if (!mr->name || regex_match(mr->name, m->wlr_output->name)) {
|
||||
|
||||
m->mfact = mr->mfact;
|
||||
m->nmaster = mr->nmaster;
|
||||
m->m.x = mr->x;
|
||||
m->m.y = mr->y;
|
||||
|
||||
if (mr->layout) {
|
||||
for (jk = 0; jk < LENGTH(layouts); jk++) {
|
||||
if (strcmp(layouts[jk].name, mr->layout) == 0) {
|
||||
|
|
@ -2613,18 +2615,8 @@ void reapply_monitor_rules(void) {
|
|||
}
|
||||
}
|
||||
|
||||
void reload_config(const Arg *arg) {
|
||||
void reapply_border(void) {
|
||||
Client *c;
|
||||
Monitor *m;
|
||||
int i, jk;
|
||||
Keyboard *kb;
|
||||
char *rule_monitor_name = NULL;
|
||||
parse_config();
|
||||
init_baked_points();
|
||||
handlecursoractivity();
|
||||
reset_keyboard_layout();
|
||||
reset_blur_params();
|
||||
run_exec();
|
||||
|
||||
// reset border width when config change
|
||||
wl_list_for_each(c, &clients, link) {
|
||||
|
|
@ -2634,14 +2626,20 @@ void reload_config(const Arg *arg) {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// reset keyboard repeat rate when config change
|
||||
void reapply_keyboard(void) {
|
||||
Keyboard *kb;
|
||||
wl_list_for_each(kb, &keyboards, link) {
|
||||
wlr_keyboard_set_repeat_info(kb->wlr_keyboard, repeat_rate,
|
||||
repeat_delay);
|
||||
}
|
||||
}
|
||||
|
||||
// reset master status when config change
|
||||
void reapply_master(void) {
|
||||
|
||||
int i;
|
||||
Monitor *m;
|
||||
for (i = 0; i <= LENGTH(tags); i++) {
|
||||
wl_list_for_each(m, &mons, link) {
|
||||
if (!m->wlr_output->enabled) {
|
||||
|
|
@ -2656,8 +2654,12 @@ void reload_config(const Arg *arg) {
|
|||
m->gappov = gappov;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// reset tag status by tag rules
|
||||
void reapply_tagrule(void) {
|
||||
Monitor *m;
|
||||
int i, jk;
|
||||
char *rule_monitor_name = NULL;
|
||||
wl_list_for_each(m, &mons, link) {
|
||||
if (!m->wlr_output->enabled) {
|
||||
continue;
|
||||
|
|
@ -2680,7 +2682,21 @@ void reload_config(const Arg *arg) {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void reload_config(const Arg *arg) {
|
||||
parse_config();
|
||||
init_baked_points();
|
||||
handlecursoractivity();
|
||||
reset_keyboard_layout();
|
||||
reset_blur_params();
|
||||
run_exec();
|
||||
|
||||
reapply_border();
|
||||
reapply_keyboard();
|
||||
reapply_master();
|
||||
|
||||
reapply_tagrule();
|
||||
reapply_monitor_rules();
|
||||
|
||||
arrange(selmon, false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue