2021/01/25
To automatically open a GUI program when you boot your Raspberry PI running LXDE, the only way that works as of January 2021 is to add a *.desktop
file inside the /home/pi/.config/autostart/
folder.
In my case, I needed to run a .NET 5.0 server app I wrote, and I needed it to run inside a terminal window so the server output was easily visible when connecting via VNC. So I created the file /home/pi/.config/autostart/MyServerName.desktop
and added the following lines:
Rebooted, and the lxterminal
window opened as soon as the pi user logged in.
There is a huge number of StackOverflow answers and blog tutorials saying that adding entries to the files /home/pi/.config/lxsession/LXDE-pi/autostart
or /etc/xdg/lxsession/LXDE-pi/autostart
. Unfortunately, they are all wrong, and there is very little up-to-date information showing what works and what doesn’t.