I'm working on a small project right now. I want the python script to automatically run after loggin into the GUI.
I followed the steps here: https://www.raspberrypi.org/forums/view ... 91&t=65607
But it didn't work for me. What it did was whenever I open up the terminal, the script will run automatically, but not after loggin into the GUI.
So I figured a easy solution is to configure the system so terminal runs after loggin into GUI.
Any suggestions?
To auto-start the terminal on boot, open this file with nano:
nano ~/.config/lxsession/LXDE-pi/autostart
Add this line to the end of the file:
@lxterminal
Close, save and reboot
Reference and some other goodies to run a script on startup as well which may have been what you are actually looking for: http://blog.startingelectronics.com/auto-start-a-desktop-application-on-the-rapberry-pi/
When you edit or create autostart file in your user space like
~/.config/lxsession/LXDE-pi/autostart
then, this file will override global lxsession autostart file in
/etc/xdg/lxsession/LXDE-pi/autostart
so you should copy everything from global file to your newly created file. By this way , after reboot you won't get a blank screen running openbox.
So, your file should contain
@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
@xscreensaver -no-splash
point-rpi
And then add your necessary startup items at the bottom like
@lxterminal
In case you want to launch a terminal and automatically run a script inside it, you can do so by passing the --command
parameter to the lxterminal
command.
sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
Right above the @xscreensaver
line, add @lxterminal --command=/path/to/script"
My autostart
file looks something like this.
@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
@lxterminal --command="/path/to/script"
@xscreensaver -no-splash
point-rpi
Note: In some places, it is suggested to use the -e
flag instead of --command
parameter in lxterminal
, however that did not work for me. This did.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With