Context
- XFCE4
Issue
Trying to run a software with a bunch of environment's variables stored into a file named prod.env, directly from autostart.
Here is the content of the .desktop file stored at /home/user/.config/autostart/player.desktop :
[Desktop Entry]
Encoding=UTF-8
Name=blablabla
Comment=
Path=/appli/player/
Exec=/bin/bash /appli/player/run.sh start
Terminal=false
Type=ApplicationAccording to documentation, there is no field related to this feature.
Have you a trick that allow to run a program with an environment variables file, using autostart ?
1 Answer
First, make sure that /appli/player/run.sh is executable and has an appropriate shebang line, so that it can be run directly (without /bin/bash). Then change the Exec line to
Exec=/bin/sh -c '. path/to/prod.env && /appli/player/run.sh start'This will source the prod.env file, making its contents available in the environment in which /appli/player/run.sh start is executed.
You can replace /bin/sh with /bin/bash if you prefer, but sh is a lighter shell.