Skip to content

Instantly share code, notes, and snippets.

@huksley
Last active July 19, 2024 22:23
Show Gist options
  • Save huksley/d5c2cda34094e63d6133fb0104e37eb9 to your computer and use it in GitHub Desktop.
Save huksley/d5c2cda34094e63d6133fb0104e37eb9 to your computer and use it in GitHub Desktop.
Raspberry PI OS Lite configure kiosk - shows multiple web pages as chrome tabs and rotates between them
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get install --no-install-recommends -y xserver-xorg xinit x11-xserver-utils
sudo apt-get install -y chromium-browser matchbox-window-manager xautomation unclutter xdotool
sudo tee /boot/kiosk.sh <<EOF
#!/bin/sh
xset -dpms # disable DPMS (Energy Star) features.
xset s off # disable screen saver
xset s noblank # don't blank the video device
setxkbmap -option "terminate:ctrl_alt_bksp"
matchbox-window-manager -use_titlebar no &
unclutter -idle 0.5 & # hide X mouse cursor unless mouse activated
# Disable crash status in chromium
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
URLS="https://google.com https://github.com/trending"
chromium-browser \$URLS \\
--enable-features=OverlayScrollbar,OverlayScrollbarFlashAfterAnyScrollUpdate,OverlayScrollbarFlashWhenMouseEnter \\
--window-size=1920,1080 \\
--window-position=0,0 \\
--start-fullscreen \\
--kiosk \\
--incognito \\
--noerrdialogs \\
--disable-translate \\
--no-first-run \\
--fast \\
--fast-start \\
--disable-infobars \\
--disable-features=TranslateUI \\
--disk-cache-dir=/dev/null \\
--overscroll-history-navigation=0 \\
--check-for-update-interval=31536000 \\
--disable-pinch &
# Start the kiosk loop. This keystroke changes the Chromium tab
# To have just anti-idle, use this line instead:
# xdotool keydown ctrl; xdotool keyup ctrl;
# Otherwise, the ctrl+Tab is designed to switch tabs in Chrome
while (true)
do
xdotool keydown ctrl+Tab; xdotool keyup ctrl+Tab;
sleep 15
done
EOF
tee /home/pi/.xinitrc<<EOF
sh /boot/kiosk.sh
EOF
tee /home/pi/.bashrc<<EOF
if [ -z "\$SSH_CLIENT" ] || [ -z "\$SSH_TTY" ]; then
startx
fi
EOF
@huksley
Copy link
Author

huksley commented Nov 20, 2021

Running offline with local files

  • Disable wait for network at boot
  • Place files to /boot

Change URLS="file:///1.html"

Enable accelerated video (Raspberry PI 4)

https://blog.adafruit.com/2020/10/09/raspberry-pi-4-hardware-accelerated-video-decoding-in-chromium-piday/

@huksley
Copy link
Author

huksley commented Jan 10, 2022

Watchdog to automatically restart Raspberry PI if it became unresponsive https://diode.io/raspberry%20pi/running-forever-with-the-raspberry-pi-hardware-watchdog-20202/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment