Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

On Raspberry Pi - Auto start terminal after login?

Tags:

raspberry-pi

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?

like image 837
Richard Yang Avatar asked Apr 07 '16 04:04

Richard Yang


3 Answers

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/

like image 136
bbergvt Avatar answered Apr 29 '23 13:04

bbergvt


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
like image 21
Whois7pi Avatar answered Apr 29 '23 11:04

Whois7pi


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.

Open the autostart file

sudo nano /etc/xdg/lxsession/LXDE-pi/autostart

Edit the autostart file

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.

like image 21
Sayan Sil Avatar answered Apr 29 '23 12:04

Sayan Sil