My .profile
does more than just set environment variables so I've split off the environment setting tasks to a .setenv
file which only sets the environment. To get it to set the environment for X11 on Debian, I added a .xsessionrc
in my home with:
. ~/.setenv
The file that causes .xsessionrc
to be sourced is /etc/X11/Xsession.d/40x11-common_xsessionrc
.
Using the files that bash uses to set its environment did not do what I want. Sure, if I started a bash shell in X11, I'd get the environment I wanted. However, I need to have my PATH set so that my desktop environment will run the software I want. For instance, I often use custom versions of Firefox, installed outside the usual paths. I want my desktop environment to start the proper version rather than use whatever it can find on the default paths. To do this, PATH must be set before the desktop environment starts.
Thanks,
.profile
worked. – Ryan C. Thompson – 2010-03-18T18:05:22.5431Also, .profile is really nice because I can put any bash code I want to in it. So I cna add to existing environment variables, and do other stuff entirely. – Ryan C. Thompson – 2010-03-22T22:09:58.597
1It seems that for KDE you need to put this in
~/.kde/env/
and end it with.sh
. See thestartkde
manpage. – Ryan C. Thompson – 2010-07-11T05:03:35.6972Actually, this seems a bit more complicated. It depends on your choices distribution, desktop environment, and even your login shell. For Gnome on Ubuntu 10.04, you have to put your setup script in
~/.gnomerc
, as shown in/etc/X11/Xsession.d/55gnome-session_gnomerc
.KDE reads the profile script for whichever shell is your login shell. IfSHELL=bash
, then it reads~/.profile
. IfSHELL=zsh
, then it reads~/.zprofile
. I don't know what it does for other shells. – Ryan C. Thompson – 2010-08-27T19:20:37.937