Skip to content

Instantly share code, notes, and snippets.

@loleg
Created November 3, 2023 10:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save loleg/788f0310434d72be5e6858b5b09f4e63 to your computer and use it in GitHub Desktop.
Save loleg/788f0310434d72be5e6858b5b09f4e63 to your computer and use it in GitHub Desktop.
Startup script for the digital signage based on Raspberry Pi Zero
[Unit]
Description=Kiosk
PartOf=graphical-session.target
After=graphical-session.target
[Service]
Environment=DISPLAY=:0.0
Environment=XAUTHORITY=/home/pi/.Xauthority
ExecStart=/bin/bash /home/pi/kiosk.sh
Restart=always
RestartSec=10s
KillMode=process
TimeoutSec=infinity
User=pi
Group=pi
[Install]
WantedBy=graphical-session.target
#!/bin/bash
# Requirements for this script, which belongs in your /home/pi folder:
#
# - Basic Rasbian OS set up to auto-boot into a plain GUI
# - sudo apt remove xscreensaver
# - sudo apt-get install -y epiphany-browser xinit unclutter xautomation raspberrypi-ui-mods
# - cp kiosk.service /lib/systemd/system/kiosk.service
# - rm /etc/xdg/autostart/light-locker.desktop
# Configure the URL that our digital signage uses
export AURL="https://www.effinger.ch/display/?theme=black"
# Prevent screensavers
xset s noblank
xset s off
xset -dpms
# Turn screen to the right (or left, as needed) for portrait mode
# Note: you need to do this in config.txt on older Pi's
xrandr -o right
# Hide the mouse cursor
unclutter -idle 0.5 -root &
# Give us a minute to breathe .. so much excitement .. for just one little Raspberry!
sleep 1
# OK, I'm good. Let's continue ..
cd /home/pi/.local/share/
# Load a web browser with a pre-set profile (Chromium is no longer supported, hence Epiphany browser)
# (seems to be only reliable way to ensure we always open the tab correctly)
epiphany -a --profile ./org.gnome.Epiphany.WebApp-effinger.ch-805bb944b6a420451f51602f03d8608bfd50b49a $AURL &
# Give us another minute .. give us two!
sleep 120
# Hit the F11 key for full-screen glory
DISPLAY=:0 xte 'key F11'
# Go have a cup of tea, relax, and enjoy a wonderful day of coworking <3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment