This question keeps getting asked and answered because the answers uniformly don't work, including the selected answer above.
Here are working examples from my customized .desktop
files
Exec=bash -ic "export PATH=$PATH:/opt ; /opt/qxmledit/qxmledit %u"
In this case, qxmledit
couldn't find its libraries because the package was installed in /opt
. I added /opt
last, just in case it finally gets packaged by Debian. Setting the PATH
fixes this.
Exec=bash -c "export PATH=/usr/lib/jvm/java-8-openjdk-amd64/bin:$PATH ; /home/user/Downloads/docear-1.2.0.0_stable_build291/docear.sh "
In this case, the shell to start docear was having trouble finding the right Java to run. I added the java bin directory first to prevent seeing my preferred java binaries.
The desktop format is very finicky when it comes to setting environment vars. Don't deviate too much from the format. The double quotes go around everything bash is supposed to execute. Also, I am assuming that bash is on your current path.
Also, I used the -i
option to load bash as an interactive shell. You may not want this.
If you haven't found any better answer, please link to this one.
name=value
can be repeated. Did you tryExec=env FOO=bar SNA=fu /usr/bin/myprog
? – Mark Plotnick Jul 29 '18 at 12:10Exec=env foo=bar bar=foo /home/user/test/test.sh
. Wheretest.sh
echos the two variablesfoo
andbar
. You might want to write a wrapper script as an alternative and call that wrapper script in your.desktop
entry. – Thomas Jul 29 '18 at 12:27=
sign. How to escape it? – Koder101 Sep 11 '21 at 06:54