use dbus-update-activation-environment to update/initialize
environment variables The goal is to update the environment variables for the user's systemd session **and** the services listening on user's d-bus session. Until now, the variables were updated using the `import-environment` environment command of `systemctl`. But, it would only be executed if systemd was present on the host system. Leaving the variables on the d-bus side either uninitialized or with incorrect values. Therefore, instead of using `systemctl`, use the `dbus-update-activation-environment` command to initialize/update the environment variables for user's d-bus session but also for user's systemd session. This is done by passing the `--systemd` option. When systemd is not detected, the command doesn't fail, it simply doesn't update the variables for user's systemd session. And since a systemd user session doesn't exist, no harm no foul.
This commit is contained in:
parent
80209d5aad
commit
c22dcdfe06
1 changed files with 2 additions and 2 deletions
|
|
@ -38,9 +38,9 @@ export QT_AUTO_SCREEN_SCALE_FACTOR=1
|
|||
export QT_ENABLE_HIGHDPI_SCALING=1
|
||||
export DCONF_PROFILE=cosmic
|
||||
|
||||
if command -v systemctl >/dev/null; then
|
||||
if command -v dbus-update-activation-environment >/dev/null; then
|
||||
# set environment variables for new units started by user service manager
|
||||
systemctl --user import-environment XDG_SESSION_TYPE XDG_CURRENT_DESKTOP DCONF_PROFILE
|
||||
dbus-update-activation-environment --systemd XDG_SESSION_TYPE XDG_CURRENT_DESKTOP DCONF_PROFILE
|
||||
fi
|
||||
# Run cosmic-session
|
||||
if [[ -z "${DBUS_SESSION_BUS_ADDRESS}" ]]; then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue