Anyone know how to use environment variables or something similar in an LXSession autostart file? My initial attempts seem to have failed :-(. I'm creating a Chromium kiosk noticeboard and need an easy way to configure the website and don't want to have users editing the LXSession autostart file directly.
2 Answers
Could not make this work directly but the launching a shell script from within the autostart file does work and it can contain environment variables. However remember to launch via a shell so...
# In .../autostart place this @/bin/bash /usr/bin/script_with_env_vars.sh # # Calling directly will not work @/usr/bin/script_with_env_vars.sh - fails!!! - unfortunately a subprocess set variables only for itself and its children. It doesn't affect the parent environment.Marcelo Pacheco– Marcelo Pacheco2020-11-25 17:07:44 +00:00Commented Nov 25, 2020 at 17:07
The way to do it is with .xinitrc. Notice if .xinitrc exists, its responsible to start the desktop environment (startlxde/startkde/...). I tried to just set TERM and exit and my XDE login just crashed.
#!/bin/bash export TERM=linux exec startlxde Trying to run a child process to set the environment is futile as it happily changes its own environment then exit, leaving the parent process environment unchanged.