#!/bin/bash # Launch Home Assistant Dashboard from TTY # This script can be run from TTY to start the dashboard on the graphical session export XDG_RUNTIME_DIR=/run/user/1000 export WAYLAND_DISPLAY=wayland-0 # Check if Firefox is already running if pgrep -u kyle firefox > /dev/null; then echo "Firefox is already running. To restart, run: ~/scripts/stop-dashboard.sh first" exit 0 fi # Get URL from main script (supports token if configured) # Extract the default URL from homeassistant-dashboard.sh HA_URL=$(grep "^HA_URL=" ~/scripts/homeassistant-dashboard.sh | sed 's/.*HA_URL="${HA_URL:-\([^}]*\)}"/\1/') # If extraction failed, use default if [ -z "$HA_URL" ]; then HA_URL="http://homeassistant.local:8123/lovelace/default_view" fi echo "Launching Home Assistant Dashboard..." echo "URL: $HA_URL" # Hide cursor if command -v unclutter &> /dev/null; then unclutter -idle 3 -root & fi # Launch Firefox in kiosk mode MOZ_ENABLE_WAYLAND=1 firefox --kiosk \ --no-remote \ --new-instance \ --disable-infobars \ --disable-session-restore \ "$HA_URL" > /tmp/firefox.log 2>&1 & sleep 2 if pgrep -u kyle firefox > /dev/null; then echo "✓ Dashboard launched successfully!" echo " Check your display - Firefox should be in fullscreen kiosk mode" else echo "✗ Failed to launch Firefox. Check /tmp/firefox.log for errors" tail -10 /tmp/firefox.log 2>/dev/null fi