Let’s start by installing Chromium and a few additional components. As always, that is integrated into an Ansible Playbook, so I can easily re-do or modify the entire installation:
I want an icon on the desktop, which lets the user start the browser with a click. Raspbian uses the lightweight LXDE, all I have to do is drop a
.desktop file into
~/Desktop/. First the
.desktop file for the browser:
[Desktop Entry] Name=Fullscreen Browser Comment=Browser Icon=/home/pi/chromium_icon.xpm Exec=/usr/bin/chromium-browser Type=Application Encoding=UTF-8 Terminal=false Categories=None; Path=/home/pi
I copied the browser XPM file from the Chromium project into my Playbook directory (another possible way is to download the icon straight away in the Playbook), and place it in the home directory of the
pi user. Now let’s upload everything to the Pi:
So far, so good. But this does not start the browser in full screen, and it does not automatically jump to the openHAB HABpanel website, and most important: it does not start the browser when the Pi starts.
First things first, I need to modify the
.desktop file and add a few more options:
[Desktop Entry] Name=Fullscreen Browser Comment=Fullscreen Browser Icon=/home/pi/chromium_icon.xpm Exec=/usr/bin/chromium-browser --start-fullscreen --noerrdialogs --disable-session-crashed-bubble --force-device-scale-factor=0.50 http://openhab/habpanel/#/view/Home Type=Application Encoding=UTF-8 Terminal=false Categories=None; Path=/home/pi
Browser.desktop file will start Chromium in full screen mode, scale down the display size to “50%” (which seems to be the right size to show the HABpanel on a 7" screen), and avoid popping up the
restore session dialog if the browser crashed. It also adds a URL which the browser will navigate to, once it starts. In my case that is the “Home” view on my openHAB installation, you might want to change that to a separate view.
Last but not least: the autostart. LXDE has an autostart option. All you have to do is place the
.desktop file in the
~/.config/autostart/ folder. Of course the folder doesn’t exist in the beginning, therefore it needs to be created. Ansible can do that as well:
The next time the Pi starts, it will open a browser in full screen, and navigate to your openHAB installation.