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.
Asked
Active
Viewed 968 times
2 Answers
0
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!!!

Paul D Smith
- 261
- 1
- 3
- 7
-
unfortunately a subprocess set variables only for itself and its children. It doesn't affect the parent environment. – Marcelo Pacheco Nov 25 '20 at 17:07
0
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.

Marcelo Pacheco
- 209
- 2
- 3