Skip to content

Instantly share code, notes, and snippets.

@danawoodman
Last active February 7, 2024 05:22
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 danawoodman/75d84b33c14445f2e08582aad609beb2 to your computer and use it in GitHub Desktop.
Save danawoodman/75d84b33c14445f2e08582aad609beb2 to your computer and use it in GitHub Desktop.
How to setup a Raspberry Pi to start up a web page in kiosk mode

Start a web page in kiosk mode on a Raspberry Pi

Install dependencies

Start by installing chromium and unclutter which will hide the cursor on the screen:

sudo apt install -y -no-install-recommends chromium-browser unclutter

Configure autostart

The autostart file is part of the LXDE (Lightweight X11 Desktop Environment) and LXQt desktop environments, commonly used in lightweight distributions of Linux, including Raspberry Pi OS. This file is used to automatically start applications and run scripts when the LXDE desktop session begins.

Open up the autostart config in your favorite editor:

sudo vi /etc/xdg/lxsession/LXDE-pi/autostart

Then paste in the follow contents:

# xset is a utility for setting user preferences for X (the window system)

# disables the screen saver feature that blanks the screen:
@xset s noblank

# turns off the screen saver, ensuring the screen doesn't get blanked after a period of inactivity:
@xset s off

# disables DPMS (Display Power Management Signaling), preventing the monitor from entering standby, 
# suspend, or off modes automatically:
@xset -dpms

# use unclutter to hide the cursor:
@unclutter -idle 0

# open chromium in kiosk mode without dialogs/navbars etc:
@chromium-browser --noerrdialogs --disable-infobars --kiosk <YOUR_URL_HERE>

Change <YOUR_URL_HERE> to your URL, say https://google.com.

Configure lightdm

LightDM is a lightweight display manager for the X window system. A display manager is a graphical login manager which starts a session, manages user authentication, and then loads the desktop environment.

Now, edit the lightdm config:

sudo vi /etc/lightdm/lightdm.conf

...and find the xserver-command line under the [Seat:*] section and change it to:

xserver-command=X -s 0 dpms

Apply settings

Finally, reboot to see your new web page loaded in kiosk mode

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