Re: environment variables



How do I set environment variables from within a gtk application?
Assume that I want to to be able to set EDITOR to vi/emacs from within
my gtk app and then I want any new terminal / application opened in the
window manager to have the same value for EDITOR until I close my window
manager to end my session.

Is it possible? and is it window manager specific?

To set an environment variable you use setenv(3) or putenv(3).
[putenv(3) is more portable, setenv is a nicer interface].  

However environment variables are inherted, you can't push them up the
process tree.  So calling setenv will only affect processes you create.

To do what you want to do you will need to work out if your window
manager has a method of changing its enviromnent variables to pass on to
any children.

        Regards,
        nash

-- 
Brett Nash <nash nash nu>
Sometimes it's better to light a flamethrower than curse the darkness.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]