.Desktop EXEC universal home path

I am making .desktop for teamspeak as their programmers didn't.

It ought to work for everyone and to do so I need to target home folder universaly with EXEC.

So let's pretend program X is in ~/.local

  • /home/username/.local/X this way works only for me

EDIT: This solved it for EXEC but doesn't apply to the ICON thus I placed it to /usr/share/icons which is workaround.


Solution 1:

You can use the environment variable HOME. It stores the absolute path to the current user's home folder.

Here's how you can use it:

Exec=/bin/sh -c "$HOME/.local/X"

It's very important putting the $ before HOME so it's read as a variable. Also do not forget write HOME in capital letters only.

Don't forget to wrap shell variable using " double quote else it will fail at execution time.