Pergunta

My program requires an environment variable as part of one of its parameters:

myprogram --folder=$HOME/.special

However, if I put this into a .desktop file's exec line, it doesn't work:

Exec=myprogram --folder=$HOME/.special

The $HOME seems to resolve to nothing.

Foi útil?

Solução

By default environment variables do not seem to be resolved by all implementations, however you can instead exec sh, which will resolve the passed environment variable. Note that the desktop spec also requires you to escape the = and $ character with a backslash. So you want:

Exec=sh -c "myprogram --folder\=\$HOME/.special"

For the full list of characters that need escaping, see the specification

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top