Skip to content

Setup Raspberry Pi kiosk:Chromium will auto load bing and google tabs



Chromium will auto load bing and google tabs, and xdotool will cycle between the tabs every 30 seconds
 

   



                                 




The first step is to get Raspbian Pi  OS installed on  Raspberry Pi 3 and 4 to be a digital signage kiosk and using it to show bing and google.
1.Step:
Installing web browser and update system

pi@raspberrypi:~ $ sudo apt-get install -y chromium-browser unclutter xdotool
and
pi@raspberrypi:~ $ sudo apt-get update  

2.Step:
Setup Auto login for pi user
The Raspberry Pi should auto log in by default, but if not you can check the setting for that by running sudo nano /etc/lightdm/lightdm.conf and looking for:

[SeatDefaults] autologin-user=pi

3.step:
Create Then we need to create the auto login task which will run the script.


nano /home/pi/.config/autostart/kiosk.desktop  

and added:

[Desktop Entry] Type=Application Name=Kiosk Exec=/home/pi/kiosk.sh X-GNOME-Autostart-enabled=true

4.step:
Setup the kiosk.sh script.

pi@raspberrypi:~ $ nano /home/pi/kiosk.sh

#!/bin/bash export DISPLAY=:0 unclutter & sed -i ‘s/”exited_cleanly”:false/”exited_cleanly”:true/’ /home/kiosk/.config/chromium/Default/Preferences sed -i ‘s/”exit_type”:”Crashed”/”exit_type”:”Normal”/’ /home/kiosk/.config/chromium/Default/Preferences # Run Chromium and open tabs /usr/bin/chromium-browser –window-size=1920,1080 –kiosk –window-position=0,0 http://rtd.opm.jbv.no:8080/web_client/std?station=SK%C3%98 https://nlogic.zendesk.com/agent/filters/62364849 & while (true) do xdotool keydown ctrl+Tab; xdotool keyup ctrl+Tab; sleep 30 done


5.Step: 
Then make the script executable by running
pi@raspberrypi:~ $ chmod +x kiosk.sh

INFO: Chromium will auto load Zendesk and Train departures tabs, and xdotool will cycle between the tabs every 30 seconds. I’m also performing some Chrome clean up in case the system reboots without closing Chrome. This will remove the nag bar.



Managing the system after it’s setup

If you make any changes and want to log out without rebooting, I’ve found that this command works.

This will kill the kiosk.sh script and restart the Windows service which will log out and log in the kiosk user.

pi@raspberrypi:~ $ sudo killall kiosk.sh && sudo service lightdm restart

How to exit Kiosk mode

The Raspberry Pi PIXEL Desktop allows you to press the Windows key on your keyboard to open their menu.
You can then navigate the menu to
Accessories >
Terminal. 

Once in the terminal type
sudo killall chromium-browser

or just press Alt+F4 to close Chromium.

The kiosk.sh script will still be running, this script has the xdotool keydowns running (see above). We need to kill that too with sudo killall kiosk.sh To remove it all together, refer to the above to remove the /home/pi/.config/autostart/kiosk.desktop file.
Published inRaspberry Pi

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This web site powered by Emin Yardim