You are not logged in.

#1 2024-03-25 17:16:12

kulak
Member
Registered: 2020-12-27
Posts: 23

Controlling Desktop (Gnome) Environment Variables

Hi,

Yesterday I spent a lot of time looking for ways to set environment variable when running Gnome desktop.  And I failed.  There are multiple pages, lots of advice to set various files under '$HOME' such as:

- .xprofile
- .xinitrc
- .gnomerc from stackoverflow response

But none of that works.  It is especially easy to prove if shell is set to fish, because fish does not load .profile, .bashrc files.

My setup is based on archinstall for Gnome: GDM display manager with Gnome (Wayland) and fish as user shell for non-root user account.

It seems there are new ways of dealing with things, but I am a bit confused as to when these get applied and I have not tried these options yet:

- ~/.pam_environment
- ~/.config/environment.d/*.conf

I was particulary surprised by GDM and /etc/gdm/Xsession.  The file does not seem to get executed, because it starts xterm which I don't even have installed and I don't see errors in `journalctl -u gdm` logs.  Is it meant to run only for XOrg session?

I'd like to know how to setup in my environment:

- environment variable for desktop and terminal session (think Console with Ctrl-Alt-F3).  It would be nice if I could do it shell independent.
- environment variable for Gnome session.

Last edited by kulak (2024-03-25 17:17:14)

Offline

#2 2024-03-25 18:31:28

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,732
Website

Re: Controlling Desktop (Gnome) Environment Variables

I think GNOME reads ~/.profile, or at least it did last time I used it. I don't use bash for my login shell though so I'm not sure if ~/.bash_profile will be used in that case.

Otherwise I use /etc/environment for most variables. That seems to work for GNOME.

Offline

#3 2024-03-25 20:42:50

seth
Member
Registered: 2012-09-03
Posts: 51,617

Offline

#4 2024-03-26 01:05:53

kulak
Member
Registered: 2020-12-27
Posts: 23

Re: Controlling Desktop (Gnome) Environment Variables

This helps a lot.  Thank you.   I would mark it as answer if I could.

Offline

#5 2024-03-26 08:14:54

seth
Member
Registered: 2012-09-03
Posts: 51,617

Re: Controlling Desktop (Gnome) Environment Variables

Please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.

Offline

Board footer

Powered by FluxBB