Auto start Midori Browser in Fullscreen Kiosk Modus – Raspberry Pi Linux

I will show you in this tutorial how to start the Midori Browser in full screen mode (kiosk mode) automatically after the Raspberry booted. The graphical shell (desktop) of Rapsian will not be required or started.

A pratical applicaton of this would be, for example, an info monitor on an exhibition. In this project, I want to realise a small contol center for FHEM. Therefore, a PiTFT with capacitive touch screen will be used. This, however, is covered in a later tutorial.

This tutorial assumes that the Raspberyy Pi or Debian Linux computer starts in terminal/console mode and not in desktop mode loading the graphical shell.

Contents

Midori Full Screen Autostart

  1. Run the following command with the console to update the package list. After that the Midori browser and matchbox will be installed.
    sudo apt-get update && sudo apt-get install -y midori matchbox
  2. Create a new shell script file with the namestartMidori.sh in the home folder and open the Nano text editor. Name and save location can be chosen as you like.
    nano startMidori.sh
  3. Add the following code and exit the Nano text editor ctr+x. To save the changes press Y and Enter.
    
    #!/bin/sh
    xset -dpms # disable DPMS (Energy Star) features.
    xset s off # disable screen saver
    xset s noblank # don't blank the video device
    matchbox-window-manager &
    midori -e Fullscreen -a https://maker-tutorials.com
    
  4. Make the script excecutable.
    sudo chmod +x startMidori.sh
  5. You can test the script if you run the following command.
    sudo xinit ./startMidori.sh
    You can exit the Midori browser with the key combinationCTRL + ALT + F1. In case you called the scriped via SSH, you can exit the script via CTRL + c.
  6. In order to automatically excecute the script when the Raspberry starts we need to edit the rc.local file. This script is excecuted when the Raspberry starts.
    sudo nano /etc/rc.local

    Add the following code before exit 0.

    For HDMI:

    sudo xinit /home/pi/startMidori.sh &

    For PiTFT:

    FRAMEBUFFER=/dev/fb1 xinit /home/pi/startMidori.sh &

    The & at the end is important that the subsequent lines are excecuted.

    You can run the script with a time delay if you sourround the command in brackets and preprend /bin/sleep 10 && schreibst. The 10 means a delay of 10 seconds.
    (/bin/sleep 10 && xinit /home/pi/startMidori.sh) &
  7. Unfortunately, the system needs to sign in automatically to be able to run the script. You can set this up easily if you use Raspbian Jessie using sudo raspi-config and the selecting Console Autologin under boot options.

    You need to use the following command to the console if you use and older Raspbian version.

    sudo nano /etc/inittab

    Search the following line

    1:2345:respawn:/sbin/getty 115200 tty1

    and comment it with #.

    #1:2345:respawn:/sbin/getty 115200 tty1

    After this line add the following command.

    1:2345:respawn:/bin/login -f pi tty1 /dev/tty1 2>&1

    This line enables that the user pi logs in without authentication.

  8. Now you just need to restart the Raspberry pi …
    sudo reboot

    … and the Midori browser should open with the desired webpage in full screen mode.

    You will exit the Midori Browser using CTRL + ALT + F1.

Optional: Rotate screen

If you want to show the screen in vertical mode or rotate by 180 degrees you can set this up using the following steps.

  1. Open the config.txt file with the Nano editor

    sudo nano /boot/config.txt
  2. Add the following test at the beginning of the config.txt file.

    display_rotate=2
    display_rotate=0 Normal
    display_rotate=1 90 degrees
    display_rotate=2 180 degrees
    display_rotate=3 270 degrees
    display_rotate=0x10000 Mirror horizontal
    display_rotate=0x20000 Mirror vertical
  3. Exit the editing with the shortcut ctrl+x and save the changes with y.
  4. After a restart the screen will be shown rotated as you wanted.

    sudo reboot

Optional: Hide mouse pointer

  1. Install the program unclutter.
    sudo apt-get install unclutter
  2. Add unclutter & to the startMidori.sh script.
    sudo nano startMidori.sh
    
    #!/bin/sh
    xset -dpms # disable DPMS (Energy Star) features.
    xset s off # disable screen saver
    xset s noblank # don't blank the video device
    unclutter &
    matchbox-window-manager &
    midori -e Fullscreen -a https://maker-tutorials.com
    

A detailed article about “Raspberry Pi: Run Applications at System Start

Leave your vote

39 points
Upvote Downvote

Total votes: 32

Upvotes: 32

Upvotes percentage: 100.000000%

Downvotes: 0

Downvotes percentage: 0.000000%

4 Comments

Leave a Reply
  1. There’s a bug in Midori that means this guide no longer works. I’ve found if you remove the -a switch it will open fullscreen, it just takes a while for the address bar to disappear.

  2. With pi 4, the rotate screen has to be done through screen configuration, not through /boot/config.txt. Took me a while to find this so i thought i’d share it to save some grief.

  3. How do I disable screen blanking only between certain hours? I tried using sudo crontab -e and adding
    10 * * * * xset +dpms
    to change the settings every 10 minutes but nothing changes when I do
    xset -display :0 q
    using ssh from my PC. Is -display :0 correct?

  4. Hi Ben,

    Thanx for explaining the whole path how to auto start midori browser in kiosk mode for linux. It really helps people who works in linux environment.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.