From defaedb3651c7a78faee2e2c78f7033b42313afe Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Sun, 2 Mar 2025 13:55:41 +0800 Subject: [PATCH] feat: support stack layout config hot reload --- maomao.c | 3 ++- parse_config.h | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/maomao.c b/maomao.c index 8dae81f..bf770b0 100644 --- a/maomao.c +++ b/maomao.c @@ -656,7 +656,6 @@ static Atom netatom[NetLast]; /* configuration, allows nested code to access above variables */ #include "preset_config.h" -#include "parse_config.h" /* attempt to encapsulate suck into one file */ #include "client.h" @@ -681,6 +680,8 @@ struct Pertag { static pid_t *autostart_pids; static size_t autostart_len; +#include "parse_config.h" + struct vec2 { double x, y; }; diff --git a/parse_config.h b/parse_config.h index 6e40a02..449cf14 100644 --- a/parse_config.h +++ b/parse_config.h @@ -1210,6 +1210,8 @@ void parse_config(void) { void reload_config(const Arg *arg) { Client *c; + Monitor *m; + int i; Keyboard *kb; free_config(); parse_config(); @@ -1224,5 +1226,16 @@ void reload_config(const Arg *arg) { wl_list_for_each(kb, &keyboards, link) { wlr_keyboard_set_repeat_info(kb->wlr_keyboard, repeat_rate, repeat_delay); } + + for (i = 0; i <= LENGTH(tags); i++) { + wl_list_for_each(m, &mons, link) { + if (!m->wlr_output->enabled) { + continue; + } + m->pertag->nmasters[i] = default_nmaster; + m->pertag->mfacts[i] = default_mfact; + m->pertag->smfacts[i] = default_smfact; + } + } arrange(selmon, false); } \ No newline at end of file