KDE environment variables
Posted by David Zaslavsky onLet's say I want to set an environment variable so that its value will be available to all KDE applications. It's surprisingly hard to figure out how to do this — the usual Google-fu techniques come up with a lot of noise. So I wound up digging through the source to startkde (prompted by TechBase's description of the startup sequence) and figured out how to do it: any scripts with filenames matching $KDEHOME/env/*.sh will be run on startup, and changes they make to the environment are propagated to all KDE applications. Similarly to run a script on shutdown, name it something that matches $KDEHOME/shutdown/*.sh.
To find the full list of directories that KDE searches for shell scripts to run on startup, here's the command, pulled right out of startkde (well, in so many words):
kde4-config --path lib | tr : '\n' | sed -n -e 's,/lib[^/]*/,/env/,p'