We can launch applications and scripts as services during boot at various Linux run-levels as demonstrated earlier, however at-times we need to launch applications or perform scripted tasks only after the Graphical interface is loaded. For example in my usage scenario with Debian running on a Raspberry Pi, few services were failing to work as expected when launched using inti.d method as they require the host to be properly connected to the internet which only happened (in my usage scenario) after the GUI started loading.
Here is another handy way to auto-launch applications and scripts in a similar manner to "autostart" in Windows, we will be using LXDE "/home/pi/.config/autostart" folder to create shortcuts which will launch our executable after GUI starts loading.
- To get this working simply create an anyname.desktop file inside /home/pi/.config/autostart folder having the prescribed format as shown below.
- The above myscript.desktop shortcut will make LXDE load /home/pi/Desktop/mystart.sh after it gets loaded, the mystart.sh bash script in this case holds all the applications and tasks which I need to get executed on boot.
- Here are the contents of mystart.sh for reference.