session: run activation env update synchronously

dbus-update-activation-environment and systemctl --user import-environment
were fired asynchronously via spawn_async_no_shell, racing with the autostart
script. Any systemd user service started from autostart (e.g. via
labwc-session.target) could start before the import completed, leaving
WAYLAND_DISPLAY and related variables absent from its environment and those
of any apps it launches.

Run both commands synchronously via a new spawn_sync_no_shell helper so
the import is guaranteed to complete before the autostart script executes.
This commit is contained in:
Jos Dehaes 2026-04-29 11:14:21 +02:00 committed by Johan Malm
parent 7ec7a322d2
commit 998fd80737
3 changed files with 40 additions and 2 deletions

View file

@ -219,12 +219,12 @@ execute_update(const char *env_keys, const char *env_unset_keys, bool initialize
char *cmd =
strdup_printf("dbus-update-activation-environment %s",
initialize ? env_keys : env_unset_keys);
spawn_async_no_shell(cmd);
spawn_sync_no_shell(cmd);
free(cmd);
cmd = strdup_printf("systemctl --user %s %s",
initialize ? "import-environment" : "unset-environment", env_keys);
spawn_async_no_shell(cmd);
spawn_sync_no_shell(cmd);
free(cmd);
}