Added more info about how to set environment variables using pam_env

atlas_core 2022-06-21 15:02:14 -04:00
parent 9f3cd33283
commit 7e7f3a987a

@ -12,10 +12,26 @@ Environment variables are inherited from the process that starts sway. You need
## Login Manager
### PAM
Setting user environment variables via PAM (`$HOME/.pam_environment`) is deprecated since PAM 1.5.0 and therefore discouraged, see https://github.com/linux-pam/linux-pam/releases/tag/v1.5.0.
You can set environment variables through `pam_env`, however they will be set system-wide, including across different sessions and users.
There are two ways you can configure PAM to load environment variables, by editing `/etc/security/pam_env.conf` or `/etc/environment`.
Example for `/etc/security/pam_env.conf` (`QT_QPA_PLATFORMTHEME` being the variable we want to edit, `qt5ct` being the value we want to set):
```
QT_QPA_PLATFORMTHEME DEFAULT=qt5ct
```
Example for `/etc/environment` consisting of the same variable/value:
```
QT_QPA_PLATFORMTHEME=qt5ct
```
You could also edit `~/.pam_environment` the same way you would with `/etc/environment`, however that is deprecated since PAM 1.5.0 and will likely be removed at some point in the future. Therefore, this method is discouraged. See [their changelog][webref3].
For more information about this approach, see [this ArchWiki page][webref4].
### Set the Sway Config
Technically, you could set them in your sway config.
<!-- er... mind explaining how, or giving an example? -AtlasC0R3 -->
## Login Shell
If you launch sway from my login shell, your ~/.zprofile or ~/.profile should work.
@ -30,4 +46,6 @@ For more info: ```man environment.d```
[webref1]: https://www.reddit.com/r/swaywm/comments/eewutx/how_to_set_environment_variables_before_starting/
[webref2]: https://github.com/gdamjan/sway-setup
[webref2]: https://github.com/gdamjan/sway-setup
[webref3]: https://github.com/linux-pam/linux-pam/releases/tag/v1.5.0
[webref4]: https://wiki.archlinux.org/title/Environment_variables#Using_pam_env