Raspberry Pi Digital Signage

Kiosk bash script

nano /home/pi/kiosk.sh
#!/bin/bash
xset s noblank
xset s off
xset -dpms

unclutter -idle 0.5 -root &

sed -i 's/"exited_cleanly":false/"exited_cleanly":true/' /home/pi/.config/chromium/Default/Preferences
sed -i 's/"exit_type":"Crashed"/"exit_type":"Normal"/' /home/pi/.config/chromium/Default/Preferences

/usr/bin/chromium-browser --noerrdialogs --disable-infobars --kiosk https://pimylifeup.com https://www.adafruit.com &

while true; do
   xdotool keydown ctrl+Tab; xdotool keyup ctrl+Tab;
   sleep 10
done

Service file

sudo nano /lib/systemd/system/kiosk.service
[Unit]
Description=Chromium Kiosk
Wants=graphical.target
After=graphical.target

[Service]
Environment=DISPLAY=:0.0
Environment=XAUTHORITY=/home/pi/.Xauthority
Type=simple
ExecStart=/bin/bash /home/pi/kiosk.sh
Restart=on-abort
User=pi
Group=pi

[Install]
WantedBy=graphical.target

Wtih the service file created, we can enable or disable it by running the following commands:

sudo systemctl enable kiosk.service

sudo systemctl disable kiosk.service

With these codes, we can start, stop and check the status of the service:

sudo systemctl start kiosk.service

sudo systemctl status kiosk.service

sudo systemctl stop kiosk.service

References:
https://pimylifeup.com/raspberry-pi-kiosk/
https://www.danpurdy.co.uk/web-development/raspberry-pi-kiosk-screen-tutorial/

Leave a Reply

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

What is 12 + 12 ?
Please leave these two fields as-is:
IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-)