#!/usr/bin/env bash
# ARMOR OS laptop launcher
# Safe launcher for X11 laptop command station mode.
# Launches the ARMOR OS laptop command station only.

set -euo pipefail

cd /home/shire3d/ARMOR

HOST="$(hostname)"
if [ "$HOST" != "armoros" ]; then
  echo "FAIL: Wrong host. Expected armoros. Current: $HOST"
  exit 1
fi

if [ -z "${DISPLAY:-}" ]; then
  echo "FAIL: DISPLAY is not set. Start this from an X11-capable terminal."
  exit 1
fi

if [ ! -x ./venv/bin/python ]; then
  echo "FAIL: ARMOR venv missing at ./venv/bin/python"
  exit 1
fi


export QT_QPA_PLATFORM=xcb
export ARMOR_DISPLAY_PROFILE=laptop
export QT_AUTO_SCREEN_SCALE_FACTOR=0
export QT_SCALE_FACTOR="${QT_SCALE_FACTOR:-1.35}"

echo "========================================"
echo " ARMOR OS LAPTOP COMMAND STATION"
echo " Host: $HOST"
echo " Repo: $(pwd)"
echo " Display: ${DISPLAY}"
echo " Profile: ${ARMOR_DISPLAY_PROFILE}"
echo " Scale: ${QT_SCALE_FACTOR}"
echo "========================================"

./venv/bin/python main.py
