From 4cd6f5f25fc197e61bc393c8c4bb01e8543c9de5 Mon Sep 17 00:00:00 2001 From: cheykrym Date: Tue, 15 Sep 2026 17:16:42 +0300 Subject: [PATCH] update --- scripts/run.sh | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/scripts/run.sh b/scripts/run.sh index 78abb50..7d42741 100755 --- a/scripts/run.sh +++ b/scripts/run.sh @@ -21,13 +21,31 @@ if [[ ! -f "$MAIN" ]]; then exit 1 fi -export DISPLAY="${DISPLAY:-:0}" +cd "$PROJECT_DIR" + +if systemctl is-active --quiet car-ui.service; then + echo "ERROR: car-ui.service is already running." + echo + echo "Stop it before running source code directly:" + echo " sudo systemctl stop car-ui.service" + exit 1 +fi + +if systemctl is-active --quiet graphical.target; then + # Desktop mode + export DISPLAY="${DISPLAY:-:0}" + + echo "==> Starting Car UI (Desktop)" + echo " DISPLAY=$DISPLAY" +else + # Console / Car mode + export QT_QPA_PLATFORM=eglfs + + echo "==> Starting Car UI (EGLFS)" + echo " QT_QPA_PLATFORM=$QT_QPA_PLATFORM" +fi -echo "==> Starting Car UI" -echo " DISPLAY=$DISPLAY" echo " Python: $VENV_DIR/bin/python3" echo -cd "$PROJECT_DIR" - "$VENV_DIR/bin/python3" "$MAIN" 2>&1 | tee "$LOG_FILE"