My sway config contains the line:
exec_always "systemctl --user import-environment"
It works fine for setting most environment variables but it ignores my PATH setting.
If I change it to PATH1 it works fine.
Whatever this is, it's not our problem.
Then, at least update the documentation about it, and provide an alternate solution. Thanks
We have no docs about this. If you're referring to the wiki, it's user-contributed, we aren't maintaining it.
See #4398, this is more of a systemd issue and you can update the wiki with your information and the information contained in the other bug.
I don't know why, but I assumed, you were using the environment.d stuff. A had a similar bug a while ago, worth referencing: https://github.com/systemd/systemd/issues/6414
@dinnymate I was baffled by this also, why in other DE the path can be set from ~/.config/environment.d/ but from sway it was impossible while other variables were loaded.
For others stumbling uppon this and using pam, you can set path ~/.pam_environment for example like this
PATH DEFAULT=/home/@{PAM_USER}/.local/bin:${PATH}
I also came here ready to file this as a bug. It's even clearly supported in man environment.d
@EvanCarroll - there is a milion ways how the PATH could've been destroyed in the process.
For example I am currently trying to know why when Sway starts it sets up the SWAYSOCK variable but for some reason is not imported in the systemd --user environment, for some reason you can prevent that somehow.
For example when I use GDM for loggin, I don't have PATH set from systemctl --user import-environment but if I log from agetty and then start sway as service I do have the PATH :O
Well, this is the reason I found which seems to be it for me,
This is what Debian installs in /etc/profile per default. As you can see, this will statically set PATH to a value depending on the effective UID.
Essentially Debian runs /etc/profile AFTER system.d thereby overriding the environment.d setting of the PATH variable to a static string.
if [ "`id -u`" -eq 0 ]; then
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
else
PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
fi
export PATH
Yep that's propably correct, I suspect there is some garbage in /etc/profile.d/*.sh
as any program can install it and F*ck with your $PATH
# Load profiles from /etc/profile.d
if test -d /etc/profile.d/; then
for profile in /etc/profile.d/*.sh; do
test -r "$profile" && . "$profile"
done
unset profile
fi
Most helpful comment
@dinnymate I was baffled by this also, why in other DE the path can be set from ~/.config/environment.d/ but from sway it was impossible while other variables were loaded.
For others stumbling uppon this and using pam, you can set path ~/.pam_environment for example like this