diff --git a/src/config/parse_config.h b/src/config/parse_config.h index 07b5552a..d5992233 100644 --- a/src/config/parse_config.h +++ b/src/config/parse_config.h @@ -1304,12 +1304,23 @@ FuncType parse_func_name(char *func_name, Arg *arg, char *arg_value, return func; } -void set_env() { +void set_env_without_display() { for (int32_t i = 0; i < config.env_count; i++) { + if (strcmp(config.env[i]->type, "DISPLAY") == 0) { + continue; // Skip setting DISPLAY + } setenv(config.env[i]->type, config.env[i]->value, 1); } } +void set_env_display() { + for (int32_t i = 0; i < config.env_count; i++) { + if (strcmp(config.env[i]->type, "DISPLAY") == 0) { + setenv("DISPLAY", config.env[i]->value, 1); + } + } +} + void run_exec() { Arg arg; @@ -4167,7 +4178,8 @@ void reset_option(void) { init_baked_points(); handlecursoractivity(); reset_keyboard_layout(); - set_env(); + set_env_without_display(); + set_env_display(); run_exec(); reapply_cursor_style(); diff --git a/src/mango.c b/src/mango.c index f51d0325..c88fe752 100644 --- a/src/mango.c +++ b/src/mango.c @@ -5437,6 +5437,8 @@ run(char *startup_cmd) { die("startup: display_add_socket_auto"); setenv("WAYLAND_DISPLAY", socket, 1); + set_env_display(); + /* Start the backend. This will enumerate outputs and inputs, become the * DRM master, etc */ if (!wlr_backend_start(backend)) @@ -6027,7 +6029,7 @@ void setup(void) { } init_baked_points(); - set_env(); + set_env_without_display(); int32_t drm_fd, i; int32_t sig[] = {SIGCHLD, SIGINT,