> For the complete documentation index, see [llms.txt](https://pekaway.gitbook.io/van-pi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://pekaway.gitbook.io/van-pi/displays/hdmi.md).

# HDMI

#### Summary

VAN PI OS does not natively include a desktop environment and functions only as a server application.&#x20;

There are two ways to utilize HDMI:

1. **Install the Software Stack on a New Image with Desktop**:
   * This involves creating a new image with a desktop environment.
2. **Follow This Guide**:
   * If you already have an HDMI touchscreen display and want to display the dashboard on it, you can follow these steps.

Since our operating system is "headless" (without a desktop interface), we use X for graphical output and Openbox as the window manager.

**Steps to Set Up HDMI Display**

1. **Install Required Packages**:
   * Log in via SSH to the Raspberry Pi and install the necessary packages:

     ```bash
     sudo apt-get update
     sudo apt-get upgrade
     sudo apt-get install --no-install-recommends xserver-xorg x11-xserver-utils xinit openbox
     sudo apt-get install --no-install-recommends chromium-browser
     ```
2. **Configure Raspberry Pi for CLI Auto-Login**:
   * Run the following command:

     ```bash
     sudo raspi-config
     ```
   * Select:
     * `1 System Options → S5 Boot/Auto-Login → B2 Console Autologin`
   * If you notice a black border on your display later, go to `2 Display Options → D2 Underscan` and set it to "No".
3. **Set Up Openbox Autostart**:
   * Edit the Openbox autostart file:

     ```bash
     sudo nano /etc/xdg/openbox/autostart
     ```
   * Add the following lines to the end of the file:

     ```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-ALT-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 --noerrdialogs --incognito --disable-infobars --check-for-update-interval=31536000 --kiosk 'http://127.0.0.1:1880/ui/'
     ```
   * Uncomment the line `# xset -dpms` if you want the display to stay on permanently. To adjust standby times, you can set `xset -dpms 60 120`.
4. **Enable X-Server Autostart**:
   * Create or edit the `.bash_profile` file in the home directory:

     ```bash
     nano /home/pi/.bash_profile
     ```
   * Add the following line:

     ```bash
     [[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && startx -- -nocursor
     ```
5. **Reboot the Raspberry Pi**:
   * Restart the Raspberry Pi to apply the changes:

     ```bash
     sudo reboot now
     ```
6. **Optimize Performance**:
   * Assign more memory to the GPU in the Raspberry Pi configuration:
     * `4 Performance Options → P2 GPU Memory`, set it to 256MB.
   * In Chromium browser, go to `chrome://flags` and enable:
     * `ignore-gpu-blocklist`
     * `enable-gpu-rasterization`
   * To access the URL bar, remove the `--kiosk` flag from the Openbox autostart file and the `-nocursor` flag from the `.bash_profile` file. After making the necessary changes, re-add these flags for kiosk mode.

**Note**: Running the browser continuously may increase the CPU temperature, but it remains within normal limits. Testing was done without active cooling or heatsinks.
