Session Environment Variables

From KDE UserBase Wiki
Revision as of 16:10, 6 August 2011 by Mdione (talk | contribs) (how to set envvars globally for a KDE session)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

It is very simple to set environment variables that affect your whole session. KDE will execute any script it finds in $HOME/.kde/env whose filename ends in .sh, and it will maintain all the environment variables set by them. it is important that any variable you want to set must be also export'ed. For example, if you want to add paths to your PATH, simply create a file named $HOME/.kde/env/path.sh with a contents similar to this:

export PATH=$HOME/local/bin:$PATH

As you most probably want to have the same environment when using a console or accessing your machine via ssh, you will need to add to the end of your .bashrc something like this:

source $HOME/.kde/env/path.sh

You can also check how KDE actually does it. It's done in your local startkde, which normally you can find in /usr/bin/startkde. You can also can view it online. Just search for environment variables.