How do I access an environment variable in a .desktop file's exec line?

前端 未结 1 1485
不思量自难忘°
不思量自难忘° 2020-12-13 07:02

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

myprogram --folder=$HOME/.special

However, if I put this into

1条回答
  •  执念已碎
    2020-12-13 07:34

    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

    0 讨论(0)
提交回复
热议问题