Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Is there a way to set the enviroment variable in .desktop file? I'm trying to run application (eclipse) with custom gtk style, so basically I want to get the following result by runing a .desktop file:

GTK2_RC_FILES=gtkrc.custom /path/to/eclipse

I've tryied to put it in a bash script and run it from the .desktop file, but then it does not integrate well with the Unity launcher.

share|improve this question
add comment

1 Answer

up vote 14 down vote accepted

You can add an environment variable to an application by editing its .desktop file. For example, to run "digiKam" with the environment variable APPMENU_DISPLAY_BOTH=1, find the corresponding digikam.desktop file and add the setting of the variable, via the env command, to the entry "Exec":

Exec=env APPMENU_DISPLAY_BOTH=1 digikam -caption "%c" %i

In your case:

Exec=env GTK2_RC_FILES=gtkrc.custom /path/to/eclipse
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.