Running Chrome in dual screen kiosk mode on Ubuntu
Background
At work we have to large TV screens used for displaying Grafana dashboards. They are both connected to the same PC.
The PC was running Windows so anytime the PC would reboot, we would have to manually conenct to it via VNC and move the browsers around and set them in full screen mode.
As we are in the office only during work hours, the PC would be shut down and restarted everyday.
I’ve been looking around, and there’s a Windows Kiosk mode, in which it only starts whatever applicatoin you want automatically. This mode, however, doesn’t work well with multiple screens.
After digging around a bit, I figured I should be able to set this up with a programmable window manager on Linux, such as i3.
Where we’re going
- The PC boots up alone at a set time (via bios / efi config)
- The system logs the default user in automatically
- The system starts up two browser windows, each full screen on its own screen and goes to the predefined URL
Assumptions
- Distribution: Ubuntu Server 18.04
- Window manager: i3
- Browser: chromium
- VNC: x11vnc
- Shell : Bash
- User: display
- Display outputs: DP-1 and DP-2 (find yours with
xrandr
)
Installation
Get your linux distro, create an install media and install it.
Ubuntu specific pre-configuration
For Ubuntu server, there is some configuration to be done:
- Add
universe
repository in/etc/apt/sources.list
:
|
|
- Add i3 repositories (see doc here) :
|
|
Packages
|
|
Automatic Login
No Display Manager will be used. It’s not particularly useful and this allows a very lightweight install.
Automatic login will be done on TTY1.
Create an override for systemd TTY1 service by editting /etc/systemd/system/getty@tty1.service.d/override.conf
|
|
To test automatic login, make sure you’re connected to a different TTY and run
|
|
TTY1 should be logged in to display user.
VNC configuration
Set up a password for vnc connection. Read up the man, there are some useful options. I only present the most basic useful ones here.
|
|
I prefer running separate instances of Chrome, so I’ll create their directories.
|
|
X configuration
We’ll start X automatically upon login, so edit ~/.profile
|
|
Tell X to start i3 and x11vnc by creating .xinitrc
as follows
|
|
Configure i3 to show each browser on its own display. We do this by attributing each browser a class in ~/.config/i3/config
|
|
Define a script to launch the two browsers in ~/start-browsers.sh
(don’t forget to chmod +x
it)
|
|
Set up automatic shutdown via cron
Run sudo crontab -e
and add the folowing line for shutdown at 19:00. Don’t forget to configure your BIOS / EFI to start the PC in the morning.
|
|