XFCE/lightdm startup configuration files – Super User

The best answers to the question “XFCE/lightdm startup configuration files” in the category Super User.

QUESTION:

Have recently installing Debian Wheezy and using XFCE 4.8.0.3 with lighdm.

After logging in with lightdm, my ~/.bash_profile or ~/.profile are no longer sourced.
I have previously used these startup files to start ssh-agent, dropboxd and set my PATH variable.

If I understand this link (http://wiki.debian.org/DotFiles) correctly, when a display manager is in use (lightdm in this case). Then it is correct that these files do not get sourced.

So my questions are:
1) how can I make XFCE/lightdm source ~/.bash_profile or ~/.profile
or
2) what are the equivalent startup configuration files of XFCE/lightdm to start ssh-agent, dropboxd and set my PATH variable.

ANSWER:

OK eventually found a workable solution and went with 2)

To set my PATH variable.
$ cp /etc/xdg/xfce4/xinitrc ~/.config/xfce4
Then edited ~/.config/xfce4/xinitrc to include the following near the top of the file

if [ -d "${HOME}/bin" ] ; then
    PATH="${HOME}/bin:${PATH}"
fi

To start Dropbox when XFCE4 starts
$ xfce4-settings-manager
-> Session and Startup -> “Application Autostart” tab -> Add ->
Name: Dropbox
Command: /home/james/.dropbox-dist/dropboxd
-> OK

As for ssh-agent this gets started in the default xinitrc. (Can anyone recommend a GUI program to supply the passphrase)

Hope this is of assistance.

ANSWER:

I’ve also struggled a lot with this environment variable thing.
I’m using Debian Jessie + xfce4

The options that worked for me are(for the environment variables to be caught by the desktop manager):

  • With xdm or lightdm: use ~/.xsessionrc
  • With others, I haven’t tested

In the ~/.xsessionrc you may chose to :

  • put directly the variables, like PATH="$PATH:userpath"
  • or source the ~/.profile file: . $HOME/.profile, where the ~/.profile file contains the environment variables definitions

Note the dot in the second option which means source, but I think source is bash specific.
The second method is probably recommended (as argued in https://unix.stackexchange.com/questions/4621/correctly-setting-environment) and avoid having the environment variables defined in several files. Also, it’s user-specific and not system-wide like (/etc/environment, which actually didn’t work so well for me)

For terminal session, since I use bash, I set-up the environment variables in the .bash_profile or I just source the ~/.profile