Kiosk mode on Raspberry Pi

2 min read

If you want to use RPi with a monitor for displaying any useful information, may be a site, you can use browser in a kiosk mode without tabs and other UI elements.

Setting up

You need to have installed desktop version of OS and Chromium. For example, if you have no desktop environment, you can install PIXEL Desktop — default DE for Raspbian OS.

apt install -y raspberrypi-ui-mods chromium-browser

Of course, you can install desktop environment by yourself, so if you do, then you will have no problems with installing Chromium and setting up boot script correctly.

Also you need to install a package unclutter that will hide a cursor.

apt install -y unclutter

Create a directory for config file if it is not exist.

mkdir -p /home/pi/.config/lxsession/LXDE-pi/

Set up a script which run on desktop environment start.

nano /home/pi/.config/lxsession/LXDE-pi/autostart

Place here a config.

@xset s off @xset -dpms @xset s noblank @chromium-browser --kiosk --incognito -disable-translate --app=https://codex.so/taly @unclutter -idle 0

Now you can restart RPi and see a result.

Page refresh

If your site updates its content automatically like a Grafana or TweetDeck, you don't need to set up anything more.

Reload by meta tag

If this is your own simple html-site you can add the following string to the head of your site's page to enable auto refresh every 60 seconds.

<meta http-equiv="refresh" content="60" />

But if your project is a more complicated or you want to watch a site without content updating feature, you need to set up a script with will reload the page by itself.

Force page reload

Install xdotool tool.

apt install xdotool -y

Log in to user pi which desktop will be opened by default.

su pi

Create a script which will fire "refresh page" key binding event.

nano /home/pi/autorefresh-chromium.sh

Put here the following.

#!/bin/bash export DISPLAY=:0.0 export XAUTHORITY=/home/pi/.Xauthority while true; do xdotool key ctrl+r & sleep 10 #refresh time in seconds done

Set correct rights.

chmod 755 /home/pi/autorefresh-chromium.sh

And update autostart script /home/pi/.config/lxsession/LXDE-pi/autostart by adding the scenario @/home/pi/autorefresh-chromium.sh.

@xset s off @xset -dpms @xset s noblank @chromium-browser --kiosk --incognito --app=https://codex.so/taly @unclutter -idle 0 @/home/pi/autorefresh-chromium.sh

Now you can restart RPi and watch for a page that reloads every 10 seconds.

Links

raspberrypi.stackexchange.com www.raspberrypi.org