Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass XDG environment variables to xdg-autostart-generator #24960

Open
ptrnine opened this issue Oct 11, 2022 · 0 comments
Open

Pass XDG environment variables to xdg-autostart-generator #24960

ptrnine opened this issue Oct 11, 2022 · 0 comments
Labels
RFE 🎁 Request for Enhancement, i.e. a feature request xdg-autostart

Comments

@ptrnine
Copy link

ptrnine commented Oct 11, 2022

Component

systemd-xdg-autostart-generator

Is your feature request related to a problem? Please describe

The environment provided for xdg-autostart-generator is insufficient.

For example, xdg-autostart-generator cannot use autostart files in non-default locations, because
XDG_CONFIG_DIRS/XDG_DATA_DIRS is not provided (however, it already able to do that because xdg_user_dirs() in src/basic/path-lookup.c can use the XDG_* variables).
This problem is exacerbated by the fact that it is difficult to use environment generators to provide these variables, because they are usually set by some startup scripts/executables (one for each installed DE), which usually call org.freedesktop.systemd1.Manager.UnsetAndSetEnvironment and Reload for that.

Describe the solution you'd like

It would be great if generators running on user will be able to access client's XDG_* environment variables (and maybe PATH so that xdg-autostart-generator can support Exec= in non-default locations).

The change required for this can look like so (somewhere in src/core/manager.c in build_generator_environment(), or maybe better somewhere before running environment generators):

if (MANAGER_IS_USER(m)) {
    STRV_FOREACH(env, m->client_environment)
        if (startswith(*env, "XDG_"))
            strv_env_replace_strdup(ge, *env);
}

Describe alternatives you've considered

Alternative appoach is to provide some mechanism to pass the specified environment variables from m->client_environment to specific generator (but I have no idea how to implement this).

The systemd version you checked that didn't have the feature you are asking for

No response

@ptrnine ptrnine added the RFE 🎁 Request for Enhancement, i.e. a feature request label Oct 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFE 🎁 Request for Enhancement, i.e. a feature request xdg-autostart
Development

No branches or pull requests

1 participant