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/