#!/bin/bash

# echo "Running Printer Screen Menu..."
# 激活虚拟环境
source "$(dirname "$0")/.venv/bin/activate"
# echo "Virtual environment activated."
# 告诉Qt使用 eglfs 插件（无桌面环境直接利用 KMS/DRM/EGL 渲染）
export QT_QPA_PLATFORM=eglfs
# export QT_QUICK_BACKEND=software
# 如果你的屏幕触摸不生效或者显示比例不对，可能还需要下面这些环境变量：
# 触摸屏设备路径，可以通过 ls /dev/input/ 查看
# export QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS=/dev/input/event0
# export QT_QPA_EGLFS_PHYSICAL_WIDTH=150
# export QT_QPA_EGLFS_PHYSICAL_HEIGHT=90

# 若启动报错，可以打开以下变量排查 eglfs 相关日志
# export QT_DEBUG_PLUGINS=1
# echo "QT_QPA_PLATFORM: $QT_QPA_PLATFORM"
# echo "directory: $(dirname "$0")"

# echo "Starting Printer Screen Menu..."
# 启动界面
# python "$(dirname "$0")/main.py" > /dev/null 2>&1
python "$(dirname "$0")/main.py"
# .venv/bin/python main.py
