Skip to content

Automatically start a fullscreen browser on a Raspberry Pi - show openHAB HABpanel

The Raspberry Pi with the touch display for the home automation system is coming along nicely. One problem to solve: how to display the openHAB HABpanel, and which browser to use?

Firefox and Chrome don't run on Raspbian. However "Chromium" (the open source part of the Chrome browser) is. That's a good start. But how to start the browser automatically, and in full screen?

 

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:

- name: Install browser packages
  apt:
    name:
      - chromium-browser
      - chromium-browser-l10n
      - rpi-chromium-mods
      - webext-ublock-origin
    state: present

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:

- name: Copy Chromium icon
  copy:
    src: '{{ playbook_dir }}/files/chromium_icon.xpm'
    dest: '/home/pi/chromium_icon.xpm'
    owner: pi
    group: pi
    mode: 0644

- name: Copy Browser.desktop to Desktop
  copy:
    src: '{{ playbook_dir }}/files/Browser.desktop'
    dest: '/home/pi/Desktop/Browser.desktop'
    owner: pi
    group: pi
    mode: 0755

 

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

The modified "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:

- name: Create LXDE autostart directory
  file:
    path: /home/pi/.config/autostart
    state: directory
    owner: pi
    group: pi
    mode: 0700

- name: Copy Browser.desktop to autostart
  copy:
    src: '{{ playbook_dir }}/files/Browser.desktop'
    dest: '/home/pi/.config/autostart/Browser.desktop'
    owner: pi
    group: pi
    mode: 0755

The next time the Pi starts, it will open a browser in full screen, and navigate to your openHAB installation.

  • Twitter
  • Bookmark Automatically start a fullscreen browser on a Raspberry Pi - show openHAB HABpanel at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Automatically start a fullscreen browser on a Raspberry Pi - show openHAB HABpanel
  • Bloglines Automatically start a fullscreen browser on a Raspberry Pi - show openHAB HABpanel
  • Technorati Automatically start a fullscreen browser on a Raspberry Pi - show openHAB HABpanel
  • Fark this: Automatically start a fullscreen browser on a Raspberry Pi - show openHAB HABpanel
  • Bookmark Automatically start a fullscreen browser on a Raspberry Pi - show openHAB HABpanel at YahooMyWeb
  • Bookmark Automatically start a fullscreen browser on a Raspberry Pi - show openHAB HABpanel at Furl.net
  • Bookmark Automatically start a fullscreen browser on a Raspberry Pi - show openHAB HABpanel at reddit.com
  • Bookmark Automatically start a fullscreen browser on a Raspberry Pi - show openHAB HABpanel at blinklist.com
  • Bookmark Automatically start a fullscreen browser on a Raspberry Pi - show openHAB HABpanel at Spurl.net
  • Bookmark Automatically start a fullscreen browser on a Raspberry Pi - show openHAB HABpanel at Simpy.com
  • Bookmark Automatically start a fullscreen browser on a Raspberry Pi - show openHAB HABpanel at blogmarks
  • Bookmark Automatically start a fullscreen browser on a Raspberry Pi - show openHAB HABpanel with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

Trackbacks

No Trackbacks

Comments

Display comments as Linear | Threaded

No comments

Add Comment

Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
E-Mail addresses will not be displayed and will only be used for E-Mail notifications.
To leave a comment you must approve it via e-mail, which will be sent to your address after submission.
Form options