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