pi-gen: Starting chromium into kiosk mode upon start-up

In my use-case, I want the GUI to start Chromium into kiosk mode. This is done by putting settings into the autostart file.  Stage3 in pi-gen is where the GUI is first installed, so I used the 01-tweaks sub-stage to specify this.

I added the folder files under stage3/01-tweaks and created a file autostart with the following contents:

@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
@xset s off
@xset -dpms
@xset s noblank
@sed -i 's/"exited_cleanly": false/"exited_cleanly": true/' ~/.config/chromium-browser Default/Preferences
@chromium-browser --noerrdialogs --kiosk http://apple.com --incognito --disable-translate

Note that I used apple.com in this example. You can use whatever URL you like.

To copy the above file into the correct place in the image, we need to add the following lines at the end of stage3/01-tweaks/00-run.sh:

install -v -d                         ${ROOTFS_DIR}/etc/xdg/lxsession/LXDE/
install -v -m 644 files/autostart     ${ROOTFS_DIR}/etc/xdg/lxsession/LXDE/

The first line creates the LXDE folder in the image and the second line copies the autostart file above to the /etc/xdg/lxsession/LXDE/ folder in the image.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s