fix: dont set display env before x11 backend create

This commit is contained in:
DreamMaoMao 2026-07-10 08:04:56 +08:00
parent 60e6ef9b97
commit 77fff8934b
2 changed files with 17 additions and 3 deletions

View file

@ -1326,12 +1326,23 @@ FuncType parse_func_name(char *func_name, Arg *arg, char *arg_value,
return func; return func;
} }
void set_env() { void set_env_without_display() {
for (int32_t i = 0; i < config.env_count; i++) { 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); 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() { void run_exec() {
Arg arg; Arg arg;
@ -4334,7 +4345,8 @@ void reset_option(void) {
handlecursoractivity(); handlecursoractivity();
reset_keyboard_layout(); reset_keyboard_layout();
reset_blur_params(); reset_blur_params();
set_env(); set_env_without_display();
set_env_display();
run_exec(); run_exec();
reapply_cursor_style(); reapply_cursor_style();

View file

@ -5560,6 +5560,8 @@ run(char *startup_cmd) {
die("startup: display_add_socket_auto"); die("startup: display_add_socket_auto");
setenv("WAYLAND_DISPLAY", socket, 1); setenv("WAYLAND_DISPLAY", socket, 1);
set_env_display();
/* Start the backend. This will enumerate outputs and inputs, become the /* Start the backend. This will enumerate outputs and inputs, become the
* DRM master, etc */ * DRM master, etc */
if (!wlr_backend_start(backend)) if (!wlr_backend_start(backend))
@ -6150,7 +6152,7 @@ void setup(void) {
} }
init_baked_points(); init_baked_points();
set_env(); set_env_without_display();
int32_t drm_fd, i; int32_t drm_fd, i;
int32_t sig[] = {SIGCHLD, SIGINT, int32_t sig[] = {SIGCHLD, SIGINT,