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.

1 Answer 1


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
    Commented Mar 6, 2014 at 23:58

You must log in to answer this question.

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