How to set environment variables for X session? [Was Re: Any idea why starting evolution...]
Chris G
cl at isbd.net
Mon Oct 25 12:37:58 CEST 2010
On Mon, Oct 25, 2010 at 11:21:24AM +0100, Chris G wrote:
> On Sun, Oct 24, 2010 at 06:53:55PM +0200, Yves-Alexis Perez wrote:
> > On dim., 2010-10-24 at 16:28 +0100, Chris G wrote:
> > > 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.
> >
> > It does work fine here. Check something isn't cleaning up the
> > environment you're checking from.
> >
> Yes, I really don't understand what's going one as regards things set in
> .xsessionrc, however I've found that simply putting the
> gnome-keyring-daemon stuff in my .profile works OK. As it's not X
> dependent (and is actually something useful in a text only environment,
> as when I'm running without X) that's actually quite a sensible solution
> for me.
>
I've played some further and I now understand (partly) what was
confusing me:-
.xprofile gets run *before* .xsessionrc, so setting variables in
.xsessionrc doesn't show up in anything that's been run from .xprofile.
As I start up all my terminal windows from .xprofile I wasn't seeing
settings I was making in .xsessionrc.
I still don't understand why the eval $(gnome-keyring-daemon --start)
plus exports wasn't working properly when I did it in .xprofile. It
works no better in .xsessionrc but it does work when I put it in
.profile. Maybe it's something to do with what shell is used to run
each of these.
My original problem of evolution being slow to start seems to be
related to DBUS_SESSION_BUS_ADDRESS being set, when it's set
evolution tries (and fails) to get something from DBUS whereas when
it's not set evolution starts up without problems.
--
Chris Green
More information about the Xfce
mailing list