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:28:16 CEST 2010


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.

-- 
Chris Green



More information about the Xfce mailing list