5

It seems that a Gnome Wayland session ignores the file ~/.profile. At least it is not working for me under a Gdm / Gnome / wayland session with Arch Linux.

So the question is, what is the proper user file to use for environment variables for a gnome-wayland session? Does Wayland even support those kind of settings?

fixer1234
  • 27,064
  • 61
  • 75
  • 116
user5491487
  • 51
  • 1
  • 1
  • 3
  • Try [this](http://unix.stackexchange.com/questions/175971/setting-environment-variables-for-gnome-on-wayland-session-only). – Insane Oct 27 '15 at 01:30
  • 2
    gnome-wayland session ignores my ~/.profile file. But , the gnome-x11 session works fine with that file. – user5491487 Oct 27 '15 at 01:53
  • Did you ever find an answer? I have the same issue. It's vaguely mentioned [here](https://wiki.gnome.org/Initiatives/Wayland/SessionStart). – totoro Oct 09 '16 at 14:54

3 Answers3

6

Systemd version 233 (March 2017) added support for setting environment variables in ~/.config/environment.d/*.conf. See the environment.d man page and the discussion that led to the feature on this preliminary PR and this final one.

Also discussed here: https://unix.stackexchange.com/a/403196/23305

Jack O'Connor
  • 381
  • 3
  • 7
2

A way that works for me is using ~/.pam_environment.

Use man pam_env.conf for reference.

I just need some user paths added to PATH in a GNOME/Wayland session and added the following line to ~/.pam_environment.

PATH        OVERRIDE=${HOME}/bin:${HOME}/.local/bin:${PATH}
totoro
  • 121
  • 3
0

There is no way to do this in Wayland yet.

Dot files like .pam_environment, .profile, and obviously .xinitrc are ignored.

The closest way to do this would be to add a line like below to the bottom of your ~/.bashrc file (assuming you're using bash) and then setting your terminal emulator to launch on startup.

[[ $ENVSETUP != 0 ]] && export ENVSETUP=0 && exit

This would make your terminal open when you login, but immediately close. Then all your environment variables defined in the .bashrc would be set-up.