I have a command with a working .desktop Exec key as follows:

Exec=env XDG_CONFIG_HOME=/home/bean/.config/gedit/ gedit %U

I would like to use the $HOME variable instead and it works in the terminal but not when used in the .desktop file. Please correct me if I'm wrong, but I assume this is because of improper "escape characters".

I have tried numerous variations of the command with \ and {} but to no avail. After looking around I'm not even sure if what I want can be accomplished.


There are no special characters there that you would need to escape, so no it's not an escaping issue. I just read through the freedesktop.org .desktop file specification and it does not explicitly mention environment variables, neither to allow nor disallow them. Nevertheless, neither $HOME nor ~ seem to be expanded in the exec field of a .desktop file.

So, it looks like what you're attempting is not possible.

  • Thank you, @terdon. I have been looking through examples of how other applications do it and they all seem to use absolute paths in the exec field. – beanaroo Mar 6 '14 at 23:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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