From 1d58841bfd38dccb5e5d42a6a83177dbef048489 Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Sun, 16 Feb 2025 20:21:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=85=8D=E7=BD=AE=E9=87=8D?= =?UTF-8?q?=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dispatch.h | 3 ++- maomao.c | 5 +++++ parse_config.h | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/dispatch.h b/dispatch.h index 89af3f7e..4e7e168f 100644 --- a/dispatch.h +++ b/dispatch.h @@ -30,4 +30,5 @@ void incnmaster(const Arg *arg); void incgaps(const Arg *arg); void focusmon(const Arg *arg); void focusstack(const Arg *arg); -void chvt(const Arg *arg); \ No newline at end of file +void chvt(const Arg *arg); +void reload_config(const Arg *arg); \ No newline at end of file diff --git a/maomao.c b/maomao.c index 47a71018..ec3cca57 100644 --- a/maomao.c +++ b/maomao.c @@ -4452,6 +4452,11 @@ void parse_config(void) { } +void reload_config(const Arg *arg) { + free_config(); + parse_config(); +} + void setup(void) { diff --git a/parse_config.h b/parse_config.h index 9fe34d41..4539c77a 100644 --- a/parse_config.h +++ b/parse_config.h @@ -347,6 +347,8 @@ FuncType parse_func_name(char *func_name,Arg *arg, char *arg_value) { func = viewtoleft_have_client; } else if (strcmp(func_name, "viewtoright_have_client") == 0) { func = viewtoright_have_client; + } else if (strcmp(func_name, "reload_config") == 0) { + func = reload_config; } else { return NULL; }