How to open Chromium in full screen kiosk mode in minimal windows manager environment (like openbox / jwm)

84,265

Solution 1

Close the browser and edit /home/user/.config/chromium/Default/Preferences. There will be a section in regards to window_placement.

For a resolution of 1920x1080 for example:

...

"window_placement": {
   "bottom": 1080,
   "left": 0,
   "maximized": true,
   "right": 1920,
   "top": 0,
   "work_area_bottom": 1080,
   "work_area_left": 0,
   "work_area_right": 1920,
   "work_area_top": 0
}

...

I could never find a way specify this at start-up and it can change if you open new browser windows.

Solution 2

Since I have researched this topic I would like to share a link to a solution, but it may not work in a minimal window manager. So if the reason for using a minimal window manager is memory or other resource use there might be better solutions.

http://www.danpurdy.co.uk/web-development/raspberry-pi-kiosk-screen-tutorial/

sudo nano /etc/xdg/lxsession/LXDE/autostart

As you can probably guess this is a file that runs when your pi boots. To disable the screensaver add a # to the beginning of the line, this comments the line out.

@xscreensaver -no-splash

Next add these lines underneath the screensaver line

@xset s off @xset -dpms @xset s noblank

This disables power management settings and stops the screen blanking after a period of inactivity.

Now that is done we should prevent any error messages displaying on the screen in the instance that someone accidentally power cycles the pi without going through the shutdown procedure. To do this we add the following line underneath the lines you just added.

@sed -i 's/"exited_cleanly": false/"exited_cleanly": true/' ~/.config/chromium/Default/Preferences

Finally we need to tell chromium to start and which page to load once it boots without error dialogs and in Kiosk mode. To do this add the following line to the bottom of this autostart file.

@chromium --noerrdialogs --kiosk http://www.page-to.display

Solution 3

Make a copy of the file (save as old.filename)Delete the contents of the autostart and replace it sudo nano ~/.confg/lxsession/LXDE/autostart @xset s off @xset -dpms @xset s noblank @chromium-browser --noerrdialogs --incognito --kiosk https://yoursite.html

Share:
84,265

Related videos on Youtube

Maciej B
Author by

Maciej B

Updated on September 18, 2022

Comments

  • Maciej B
    Maciej B almost 2 years

    I am trying to set up a simple Ubuntu kiosk box (14.04), running only a Chromium in a very minimal windows manager environment. Steps I've successfully done:

    • Login automatically: exec /bin/login -f kiosk_user < /dev/tty1 > /dev/tty1 2>&1 in /etc/init/tty1.conf
    • Start X environment (startx in .profile)
    • Start Chromium in X environment in .xinitrc
    • Start windows manager (tried fluxbox, jwm and openbox so far) in .xinitrc

    What I currently have is Chromium starting properly but in semi-normal mode. I need to explitly press F11 from the keyboard to make Chromium to switch to the full screen and kiosk mode.

    One fellow chromium user from a mailing list said that this would work fine in full GNOME environment without any tricks (even xdotool) - so this might be somehow related to these minimal windows managers.

    I did even try to start Chromium itself without any windows manager (Chromium has something called Aura, its own WM for ChromiumOS?). In this mode, I could not get the Chromium to fill the whole screen. This method is not preferrable either as there is no possibility to open other applications easily for example for troubleshooting purposes.


    .xinitrc

    #!/bin/sh
    
    rm ~/tmp/ -Rf
    xset s off
    xset dpms 600 60 60
    xset +fp "$X_FONTPATH"
    xset fp rehash
    
    env > ~/.xenv
    
    # Run chromium start
    ~/start_chromium.sh &
    
    # Run window manager
    exec openbox
    

    start_chromium.sh

    #!/bin/sh
    
    set -e
    
    CHROMIUM_TEMP=~/tmp/chromium
    rm -Rf ~/.config/chromium/
    rm -Rf $CHROMIUM_TEMP
    mkdir -p $CHROMIUM_TEMP
    
    chromium-browser \
        --disable \
        --disable-translate \
        --disable-infobars \
        --disable-suggestions-service \
        --disable-save-password-bubble \
        --disk-cache-dir=$CHROMIUM_TEMP/cache/ \
        --user-data-dir=$CHROMIUM_TEMP/user_data/ \
        --start-maximized \
        --kiosk "file:///home/kioskuser/kiosk.html" &
    sleep 5
    xdotool search --sync --onlyvisible --class "chromium" key F11
    
    • Admin
      Admin about 10 years
      I take it you've tried just running chromium-browser --kiosk?
    • Admin
      Admin about 10 years
      Yes, I have tried just simply chromium-browser --kiosk and it works in same way as my full example above.
  • lightarrow
    lightarrow over 6 years
    You can use this with auto login for the user account.