# Setting up kiosk mode

First we'll set up our pi to boot into a slim window environment using X and Chrome so we can interact with [DWC2](https://github.com/chrishamm/DuetWebControl), which we're going to install later, on.

Let's install some dependencies.&#x20;

```bash
sudo apt-get install --no-install-recommends xserver-xorg x11-xserver-utils xinit xinput x11-utils openbox -y 
sudo apt-get install --no-install-recommends chromium-browser -y
```

Openbox is a window manager. It doesn't include any kind of menu or gui that you might expect with a normal desktop environment. This is good, we don't need it.

We'll need to edit ***/etc/xdg/openbox/autostart*** and replace it's contents with the snippet below.&#x20;

```bash
# Disable any form of screen saver / screen blanking / power management
xset s off
xset s noblank
xset -dpms

# Allow quitting the X server with CTRL-ATL-Backspace
setxkbmap -option terminate:ctrl_alt_bksp

# Start Chromium in kiosk mode
sed -i 's/"exited_cleanly":false/"exited_cleanly":true/' ~/.config/chromium/'Local State'
sed -i 's/"exited_cleanly":false/"exited_cleanly":true/; s/"exit_type":"[^"]\+"/"exit_type":"Normal"/' ~/.config/chromium/Default/Preferences
chromium-browser --disable-infobars --kiosk 'http://YOUR-IP:4750'
```

{% hint style="info" %}
Please note, you need to edit it to match the IP address of your pi
{% endhint %}

Next you'll want to edit your ***\~/.bash\_profile*** to include the line below.

```bash
[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && startx -- -nocursor
```

This is going to start X automatically when we log in. That in turn, will automatically launch chrome which we configured in the previous step.
