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 Oct 28, 2021

Force HDMI & 1080p

hdmi_force_hotplug=1
hdmi_group=1
hdmi_mode=16
disable_overscan=1

Rotate screen

echo "display_rotate=3" | sudo tee -a /boot/config.txt

Splash + hide console msgs

Change console=tty3 and add quiet splash plymouth.ignore-serial-consoles logo.nologo vt.global_cursor_default=0
in /boot/cmdline.txt (single line)

Add splash for plymouth

sudo apt install plymouth plymouth-themes pix-plym-splash
wget https://example.com/my/splash.png
sudo mv splash.png /usr/share/plymouth/themes/pix/splash.png

Move console to tty3 to disable output messages of startx

Change files in /etc/systemd/system - see getty@tty1.service.d/, getty.target.wants/basically rename everything to tty3 and change content to point to tty3 instead of tty1

See more here: https://raspberrypi.stackexchange.com/questions/36657/hide-complete-boot-message-from-rpi-booting

Remove rainbow screen at boot

Add disable_splash=1 to /boot/config.txt

Control TV with CEC

https://www.linuxuprising.com/2019/07/raspberry-pi-power-on-off-tv-connected.html
https://ubuntu-mate.community/t/controlling-raspberry-pi-with-tv-remote-using-hdmi-cec/4250

@huksley
Copy link
Author

huksley commented Oct 28, 2021

Connect sdcard and edit kiosk.sh on any OS in boot partition.

Enter URL="" any list of addresses to open, including

@huksley
Copy link
Author

huksley commented Nov 11, 2021

Connect a button for shutdown (or other scripts)
https://github.com/shivasiddharth/pi-shut/

@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