Search code examples
environment-variableswrappersymlinkgnomeexecutable-path

How to pass env variables to GNOME


I want to replace some utilities(like telnet) with transparent wrappers(with loggers). At first I used aliases, that worked nicely at the command line but gnome doesn't understand shell aliases so that when people would launch the utilities as the shell for a gnome-terminal profile it would run the actual utility instead of the wrapper.

Then I tried adding new folder with symlinks and prepended it to PATH(security isn't a huge concern plus its a special folder just for these symlinks) in ~/.bashrc but they still run the original(I'm guessing gnome doesn't run .bashrc since it works from the command line). Any ideas where setting path needs to go?


Solution

  • I found two ways to do this that seem to work like I want(sourcing scripts for gnome env).

    First putting it in ${HOME}/.gnomerc (but I found some places that say you should manually exec gnome session afterwards and others that don't(It seems to work fine without it) and I'm afraid of breaking login.)

    Putting it in ~/.profile seems to work so I just

    echo 'PATH=~/.symlink_dir/:${PATH}' > ~/.profile
    

    (note that this is ignored by bash if a ~/.bash_profile exists so you may want to manually source it from ~/.bash_profile just in case

    echo 'source ~/.profile' >> ~/.bash_profile).