Suppose that some random program Foo

  1. modifies its behavior according to the values of environment variables; and
  2. can be started by clicking on some Foo icon available through a graphical desktop.

Let's assume, for the rest of this post, that every instance of Foo under discussion was, or will be, started as described in (2) above. IOW, for this post, rule out the possibility of starting Foo via some command line.

For concreteness, let's also assume that the current X11 session was started "manually" by the user; i.e. by typing startx on the (text interface) command-line at some point after a (text-interface) login 1.

Now, AFAICT, by default, the environment inherited by every instance of Foo is the one in place at the time the user executed startx2. (Please, correct me if I'm wrong.)

My question is: Is there some generic way (i.e. independent of Foo) for me to modify the environment inherited by subsequent instances of Foo (or at least by the next instance of Foo that gets started)?

Anticipating the possibility that the answer to the (general) question above is "No", below I provide some specific details, in the hope that the more specific variant of the question will have the answer "Yes":

  1. at the moment I'm particularly interested in the case where Foo happens to be Terminator (a terminal emulator);
  2. my shell is zsh;
  3. my desktop is xfce4 + xfwm4.

1If the answer to this question would be different if X11 session was started automatically after the user logged in via a graphical login, please let me know.

2Or perhaps it would be more precise to say that the inherited environment is that consisting of the exported shell variables, and their values, as they were when the user invoked startx. I expect that even this more carefully worded description is, at best, an oversimplification, but I hope not such an extreme one as to render the rest of the post moot.

1 Answer 1


If you are starting your program from a link on your desktop, you can modify the link file to include your desired variable and value. I'm not experience with zsh (yet), but I think you can still modify the link simply by adding env VAR=VAL at the beginning of the Exec value in the link. For further reading I've found an ArchLinux article explaining a lot of the entries in a desktop file. This is an Arch article, but the format of these files is standard accross distros.

You may also be able to modify this variable for your whole session using your window manager.

You must log in to answer this question.

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