Web lists-archives.com

Re: Ideal place to set environment variables




On 20/03/18 07:59, Subhadip Ghosh wrote:
While it was very informative, it was not evident from it that what
the standard or preferred place is for setting an environment variable
if I want it to be available from both graphical applications as well as
from terminal (bash).

Under XFCE, I have ~/.config/xfce4/xinitrc something like this:

#!/bin/sh
export LC_COLLATE=C
export PATH=$HOME/bin:$PATH
export QT_QPA_PLATFORMTHEME=gtk2
export GTK_OVERLAY_SCROLLING=0
umask 007
. /etc/xdg/xfce4/xinitrc

Graphical applications (including xfce4-teminal) and its child bash inherit these exported environment variables from their parent. (And note that I assume $PATH and $HOME do not require quoting.)

The file is a script so it must be executable:
chmod 700 ~/.config/xfce4/xinitrc

Kind regards,

--
Ben Caradoc-Davies <ben@xxxxxxxxxxxx>
Director
Transient Software Limited <https://transient.nz/>
New Zealand