From 19b1fe19eb8768dc403e77f1a67bc5faafe9493a Mon Sep 17 00:00:00 2001 From: DreamMaoMao <2523610504@qq.com> Date: Sun, 4 May 2025 19:46:13 +0800 Subject: [PATCH] feat: support set env in config --- src/config/parse_config.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/config/parse_config.h b/src/config/parse_config.h index 23ee777..e424b62 100644 --- a/src/config/parse_config.h +++ b/src/config/parse_config.h @@ -1001,6 +1001,15 @@ void parse_config_line(Config *config, const char *line) { } else { fprintf(stderr, "Error: Invalid monitorrule format: %s\n", value); } + } else if (strncmp(key, "env", 3) == 0) { + + char env_type[256], env_value[256]; + if (sscanf(value, "%[^,],%[^\n]", env_type,env_value) < 2) { + fprintf(stderr, "Error: Invalid bind format: %s\n", value); + return; + } + setenv(env_type, env_value, 1); + } else if (strncmp(key, "bind", 4) == 0) { config->key_bindings = realloc(config->key_bindings,