From 7e7f3a987a14c1227eaec55c197a3a1c6e905054 Mon Sep 17 00:00:00 2001 From: atlas_core <39468657+AtlasC0R3@users.noreply.github.com> Date: Tue, 21 Jun 2022 15:02:14 -0400 Subject: [PATCH] Added more info about how to set environment variables using pam_env --- Setting-Environmental-Variables.md | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/Setting-Environmental-Variables.md b/Setting-Environmental-Variables.md index 34d48b8..860201f 100644 --- a/Setting-Environmental-Variables.md +++ b/Setting-Environmental-Variables.md @@ -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. + ## 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 \ No newline at end of file +[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 \ No newline at end of file