Chromium makes it easy to be started in “kiosk” mode, that is to say to launch in full screen, without any window border, toolbar or notification (surprisingly, this feature is not offered by Mozilla Firefox).
This makes it possible to display a presentation, or a page, on a standalone display or on a terminal… or, in my case, to display a slideshow on my television while the Raspberry Pi casts music.
Our goal will be to get:
- a minimal installation of the graphical server, without desktop environment or window manager;
- an automatic launch on startup, in full screen;
- no toolbar or notification.
To display the browser, we will have to install an X server. There is no need to install a desktop environment or window manager, unnecessarily large, since the browser will be launched directly in full screen.
sudo apt-get install xserver-xorg-video-all xserver-xorg-input-all xserver-xorg-core xinit x11-xserver-utils
Launch at startup
To start the server automatically at startup, edit the
~/.bash_profile file, which is executed when the user logs in, to put the following content (the server starts with
startx, but it is also necessary to check that a screen is available to avoid an error, for example, with SSH):
if <span class="as"></span><span class="br"> (</span><span class="mar">-z $DISPLAY</span><span class="br">)</span> && <span class="as"></span><span class="br"> (</span><span class="mar">$(tty) = /dev/tty1</span><span class="br">)</span>; then startx fi
Your system must also be configured so that the user is automatically logged in at startup. How to proceed depends on your configuration (see this page for Debian, this one for Ubuntu or that one for Arch). With Raspbian, launch
raspi-config utility, then choose
Boot Options and
We will install, of course, Chromium, but also
unclutter, which will allow us to hide the pointer of the mouse:
sudo apt-get install chromium-browser sudo apt-get install unclutter
Launch at startup
To start them automatically at startup, we create a file
~/.xinitrc (this file is executed when the X server starts) which contains the following commands (take care to choose your URL and indicate the screen resolution) :
#!/bin/sh xset -dpms xset s off xset s noblank unclutter & chromium-browser /path/to/your/file.html --window-size=1920,1080 --start-fullscreen --kiosk --incognito --noerrdialogs --disable-translate --no-first-run --fast --fast-start --disable-infobars --disable-features=TranslateUI --disk-cache-dir=/dev/null
xset commands are used to avoid the automatic standby of the system, which will otherwise interrupt the display after a specified time.
--window-size= is essential, otherwise Chromium will only be displayed on half of the screen, despite the other instructions, in the absence of a window manager.