startup, .profile, env.vars., etc.
Kevin Krammer
kevin.krammer at gmx.at
Thu May 29 13:02:05 BST 2008
On Thursday 29 May 2008, Ryo Furue wrote:
> Hi KDE users,
>
> I think this question comes up from time to time: When and how are
> environmental variables set? How are users supposed to set their own?
>
> Last time I asked this question, I eventually found that if you make a
> symbolic link in ~/.kde/env/ to your ~/.profile (or ~/.bash_profile)
> and add an extension ".sh" to the link name, then it's sourced during
> the KDE startup. Good.
Actually any directory in the list of
kde-config --path exe
but /bin replaced by /env
Any file with extension .sh in there is sourced by startkde, the script which
starts a full KDE session.
I am not sure if there is an official name for this, but I call
it "environment extender" :)
> But, today I realized that without a link in ~/.kde/env/ , my
> ~/.bash_profile is somehow sourced. My system is the testing
> distribution of Debian, which is constantly updated, and KDE has
> been updated for a few times since I set ~/.kde/env/ , I think.
> Does that mean that KDE now sources the user's ~/.profile ?
No.
However the shell running startkde might read files during its startup, e.g.
bash reads different files depending on if it is started as a login shell,
non-interactive shell, interactive shell, etc.
Thus running startkde manually from a console might get you a different
environment than having it started through KDM, GDM, etc.
> Since I first found that in konsole, I thought that my bash was invoked
> as a login shell. But, no; the value of $0 was "/usr/bin/bash" or
> something similar, not "-bash". Also I examined the env.vars. of
> /usr/bin/ssh-agent, which is invoked by ssh-add, which is in turn
> invoked from ~/.kde/Autostart/ , and sure enough, its
> env.vars. contained my own ones set in my .bash_profile.
In a Konsole window, or most likely any terminal emulator window, the shell
will be invoked as a non-login interactive shell.
Again, depending on the shell there might be differences in which files it
reads.
> This leads to another annoyance: I have launcher icons on my panels.
> I set one of them to invoke "emacs" and hoped that it would invoke
> /usr/local/bin/emacs because that's the first one in my PATH. But,
> it invokes /usr/bin/emacs instead. That probably means that the
> program that manages the panels (I don't know its name) doesn't get
> my env.vars.
>
> So, I'd like to know, once and for all, how these things work. What
> should I read?
I think the safest way is to use the environment extender mechanism or to set
the variables as a point prior to KDE startup, i.e. whereever the
distribution sets globally used environment variables.
To check how the variables of the KDE session are set, you can execute a
command through "Run Command" (or ALT+F2), like this
env > /tmp/kdeenv.txt
Cheers,
Kevin
--
Kevin Krammer, KDE developer, xdg-utils developer
KDE user support, developer mentoring
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde/attachments/20080529/d4b3040d/attachment.sig>
-------------- next part --------------
___________________________________________________
This message is from the kde mailing list.
Account management: https://mail.kde.org/mailman/listinfo/kde.
Archives: http://lists.kde.org/.
More info: http://www.kde.org/faq.html.
More information about the kde
mailing list