3

I am trying to start browser in Raspberry Pi, on boot. These are the steps I've followed so far:

  1. I have edited the .bashrc file from the root folder using this command:

sudo nano /home/pi/.bashrc

  1. Added the following line at the end the file.

midori -e Fullscreen -a http://www.google.com

  1. I restarted Raspberry Pi.

sudo reboot

It does not open the browser, on boot. How ever if I manually click on Terminal, it opens the browser.

1

5 Answers 5

3

I got a very simple solution of this. At first install midori on your pi.

sudo apt-get install midori

Then add the file that you want to auto start here.

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

For example you want to open google browser after reboot. Add this line to autostart file.

@midori -e Fullscreen -a http://google.com

Save the file and reboot your Pi. Now the google browser will auto start up every time you reboot.

1

I got the solution .

In new versions it is not supporting in this autostart file

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

I changed the code to the below autostart file.

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

You can use crontab

sudo crontab -e

And add

@reboot command_you_want_to_run &
0

I solved using autostart of LXDE-pi and a sh file.

I had to install xautomation for simulate an user input

sudo apt-get install xautomation

In the home of pi I've created a sh file

touch start_browser.sh

I've inserted the following code in the file

#!/bin/sh

# running the browser on the main desktop
sudo -u pi epiphany-browser -a --profile ~/.config http://www.google.com/ --display=:0 & 
# waits a few seconds, we wait that the browser has started successfully   
sleep 15s;
# xautomation simulates the pressure on the F11 key for activate the browser in full screen mode on the main desktop
xte "key F11" -x:0

I added the executable permission on the sh file with chmod command

sudo chmod 755 start_browser.sh

I've modified the autostart files of LXDE-pi session

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

by adding the following command to run my sh file

@/home/pi/start_browser.sh

Now our browser should be start in full screen mode at each boot

If it does not, check that the Raspberry's configuration had enabled the boot into the desktop environment

sudo raspi-config

Select: 3 Enable Boot to Desktop/Scratch

Select: Desktop Log in as user 'pi' at the graphical desktop

Enjoy

0

In latest versions of raspberian you have to edit

sudo vi .config/lxsession/LXDE-pi/autostart

for this

@midori -e Fullscreen -a http://google.com

to work..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.