fix: dont set dispaly env before x11 backend create

sf
This commit is contained in:
DreamMaoMao 2026-07-10 08:06:38 +08:00
parent 3fa1a40633
commit 6d6e32a105
2 changed files with 17 additions and 3 deletions

View file

@ -1304,12 +1304,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;
@ -4167,7 +4178,8 @@ void reset_option(void) {
init_baked_points(); init_baked_points();
handlecursoractivity(); handlecursoractivity();
reset_keyboard_layout(); reset_keyboard_layout();
set_env(); set_env_without_display();
set_env_display();
run_exec(); run_exec();
reapply_cursor_style(); reapply_cursor_style();

View file

@ -5437,6 +5437,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))
@ -6027,7 +6029,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,