#!/usr/bin/env bash # SPDX-License-Identifier: GPL-3.0-or-later set -euo pipefail KIOSK_CONFIG_FILE="${KIOSK_CONFIG_FILE:-$HOME/.config/ha-kiosk/config}" if [[ -r "$KIOSK_CONFIG_FILE" ]]; then # shellcheck source=/dev/null source "$KIOSK_CONFIG_FILE" fi : "${KIOSK_URL:?Set KIOSK_URL in ~/.config/ha-kiosk/config}" : "${TOUCH_DEVICE_NAME:=Touchscreen Device Name}" : "${TOUCH_DISPLAY_OUTPUT:=eDP-1}" : "${KIOSK_DISPLAY:=:0}" : "${KIOSK_XAUTHORITY:=$HOME/.Xauthority}" : "${CHROME_BIN:=/usr/bin/google-chrome-stable}" : "${CHROME_USER_DATA_DIR:=$HOME/.config/ha-kiosk/chrome-profile}" export DISPLAY="$KIOSK_DISPLAY" export XAUTHORITY="$KIOSK_XAUTHORITY" # Allow the desktop and touchscreen to initialise. sleep 2 # Map the touchscreen to the rotated built-in display. xinput map-to-output \ "$TOUCH_DEVICE_NAME" \ "$TOUCH_DISPLAY_OUTPUT" # Start Home Assistant in Chrome kiosk mode. "$CHROME_BIN" \ --user-data-dir="$CHROME_USER_DATA_DIR" \ --kiosk \ --noerrdialogs \ --disable-session-crashed-bubble \ --no-first-run \ "$KIOSK_URL"