From b2b23d4f422c2f779b4a85f3a229e38a7f123964 Mon Sep 17 00:00:00 2001 From: RJDan <43909727+RJDan@users.noreply.github.com> Date: Thu, 20 Jan 2022 13:50:09 -0600 Subject: [PATCH] First Draft. --- Setting-Environmental-Variables.md | 32 ++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Setting-Environmental-Variables.md diff --git a/Setting-Environmental-Variables.md b/Setting-Environmental-Variables.md new file mode 100644 index 0000000..5ad9577 --- /dev/null +++ b/Setting-Environmental-Variables.md @@ -0,0 +1,32 @@ + +How you set variables will depend on how sway was started. +The explanation below was based on these [sources][webref1] + +Environment variables are inherited from the process that starts sway. You need to set variables there. + +**Some of the possible options are:** +- login manager: check the documentation. +- login shell: export them there before launching sway. +- user service: use the EnvironmentFile= key and an environment file. + +## Login Manager + +### PAM +Set environment variables specific to user session in the `$HOME/.pam_environment`. That gets them set right on log in and would work for most methods of launching sway. +Note: these variables will be set in non-sway sessions too. + +For more info: ```man 8 pam_env``` + +### Set the Sway Config +Technically, you could set them in your sway config. + +## Login Shell +If you launch sway from my login shell, your ~/.zprofile or ~/.profile should work. + +## User Service +You can set variables using the environment.d. Environment variables set there will be read by the --user systemd, and since everything is started in its hierarchy variables will properly propagate. +This will not work with some login managers. + +For more info: ```man environment.d``` + +[webref1]: https://www.reddit.com/r/swaywm/comments/eewutx/how_to_set_environment_variables_before_starting/ \ No newline at end of file