4

I am running KDE 4.10. I have added an environment variable to my .profile, however this variable will obviously not be visible to programs that I start via the KDE GUI (as opposed to a shell with the updated environment) until I restart KDE.

Is there a way to tell KDE to re-read the environment, or to explicitly set the KDE environment via DBUS or similar mechanism?

One hack is to restart KDE programs like klauncher and krunner from a shell having the modified environment, but I'm looking for something more elegant (elegant means not having to alter the memory of running programs via gdb, haha).

Have we finally found something Windows can do easily that KDE/Linux cannot?

Update 04/18: Updated to KDE 4.10, added comment about Windows.

1 Answer 1

0

All of my efforts to do the same have been for naught... Environment variables are special things, a child cannot change the parent's environment, while a parent process can adjust things prior to forking a child.

Like you mentioned, you CAN start the needed programs from a newly started konsole, which would have inherited the new .profile settings, but for some that just isn't enough.

Alas... you'll need to log out and then back in again, as a minimum. So sorry. But look at the bright side... you don't have to reboot.

(Hmmm, start another new X-server on :1 (or :2, etc), adjust the DISPLAY env-vars of all the programs you need to keep running, to shift them to the new X server.. then kill the first server and switch to the new one. (mind you, this is somewhat easier to SAY, than DO) )


EDIT:
I had another IDEA!! If you were to use to break into the kwin process, using specially crafted function calls, you COULD add any number of environment variables, change values, whatever.... which would then be reflected in any new programs/processes you started from that point on. I've done it to change a processes 'current directory' to umount/remount things. Probably not for the faint of heart... But that's not what we cater to here is it? HeeHee! It's possible! I suppose you could also just break into every process you have running, inject the new environment variable values. Then you wouldn't have to restart anything.

Wise words from Uncle Ben (Spiderman, not the RICE! sheesh!).... "With great power, comes great responsibility" Methinks I'll just put that Idea Card in the "As Yet Unproven" stack for now. YOU do it first... I'll watch... from over here... behind this blast door...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .