From 3cd896deab3c240b46687c76d0ca2e2bcd08769c Mon Sep 17 00:00:00 2001 From: kyle Date: Wed, 31 Dec 2025 04:26:49 -0800 Subject: [PATCH] Add launch-dashboard.sh --- launch-dashboard.sh | 47 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 launch-dashboard.sh diff --git a/launch-dashboard.sh b/launch-dashboard.sh new file mode 100644 index 0000000..0c286e2 --- /dev/null +++ b/launch-dashboard.sh @@ -0,0 +1,47 @@ +#!/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