How to set environment variables for X session? [Was Re: Any idea why starting evolution...]
Chris G
cl at isbd.net
Sun Oct 24 17:46:38 CEST 2010
On Sun, Oct 24, 2010 at 04:28:16PM +0100, Chris G wrote:
> On Sun, Oct 24, 2010 at 03:57:59PM +0100, Chris G wrote:
> > On Sun, Oct 24, 2010 at 03:47:00PM +0200, Jérôme Guelfucci wrote:
> > > On 24/10/10 15:42, Chris G wrote:
> > > >What's the proper/official way to set environment variables for an X
> > > >session? I.e. how do I run a command and set some variables early in
> > > >the X session startup so that they will be available to any/all programs
> > > >in the X session?
> > > >
> > > >Setting them in .xprofile isn't early enough, that only sets variables
> > > >for programs run in terminal windows far as I can tell.
> > > >
> > >
> > > Here on Debian, I set them in .xsessionrc.
> > >
> > I tried that, totally ignored as far as I can see. I'll have another
> > try though as I'm running xubuntu which should be pretty similar to
> > Debian.
> >
> I've played some more, .xsessionrc *is* executed but environment variables
> set in .xsessionrc don't get out to the X session. Presumably
> .xsessionrc must be being run in a child process somewhere on the way in
> and thus variables set there are lost. I tried simply the following in
> my .xsessionrc :-
>
> echo ".xsessionrc starting" >/home/chris/tmp/xsession.log
> export MYENVVAR="ABCDEFG"
> echo ".xsessionrc ending" >>/home/chris/tmp/xsession.log
>
> and I got the messages in /home/chris/tmp/xsession.log but MYENVVAR
> wasn't set.
>
Just in case .xsessionrc is executed by a shell that doesn't understand
the above export I changed it to:-
MYENVVAR="ABCDEFG"
export MYENVVAR
... and it's *still* not set in my session.
Looking at my .xsession-errors I see:-
/etc/gdm/Xsession: Beginning session setup...
Warning: Only changing the first 32 of 10 buttons.
Setting IM through im-switch for locale=en_GB.
Start IM through /etc/X11/xinit/xinput.d/all_ALL linked to /etc/X11/xinit/xinput.d/default.
/usr/bin/startxfce4: X server already running on display :0
xrdb: "Xft.hinting" on line 9 overrides entry on line 6
xrdb: "Xft.hintstyle" on line 11 overrides entry on line 7
Warning: Only changing the first 32 of 10 buttons.
xfdesktop[13571]: starting up
GNOME_KEYRING_CONTROL=/tmp/keyring-vucVGR
SSH_AUTH_SOCK=/tmp/keyring-vucVGR/ssh
GNOME_KEYRING_CONTROL=/tmp/keyring-vucVGR
SSH_AUTH_SOCK=/tmp/keyring-vucVGR/ssh
** (xfce4-session:13553): WARNING **: Unable to launch
"bluetooth-applet" (specified by autostart/b>
GNOME_KEYRING_CONTROL=/tmp/keyring-vucVGR
SSH_AUTH_SOCK=/tmp/keyring-vucVGR/ssh
There's a lot of things running "gnome-keyring-daemon --start" by the
look of it! (... and probably none of them putting the result in the
environment as they should be)
--
Chris Green
More information about the Xfce
mailing list