run.sh 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #!/bin/bash
  2. # Development runner - uses the virtual environment
  3. SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
  4. # Check if virtual environment exists
  5. if [ ! -d "$SCRIPT_DIR/venv" ]; then
  6. echo "❌ Virtual environment not found!"
  7. echo " Run: sudo ./install.sh"
  8. echo " Or manually create: python3 -m venv venv && venv/bin/pip install -r requirements.txt"
  9. exit 1
  10. fi
  11. # The table (FluidNC firmware) is reached over the network and auto-discovered
  12. # via mDNS, or pinned with DUNE_WEAVER_URL. No local backend is required.
  13. echo ""
  14. echo "🚀 Starting Dune Weaver Touch (development mode)"
  15. echo " Using virtual environment: $SCRIPT_DIR/venv"
  16. if [ -n "$DUNE_WEAVER_URL" ]; then
  17. echo " Table (pinned): $DUNE_WEAVER_URL"
  18. else
  19. echo " Table: auto-discovering over mDNS..."
  20. fi
  21. echo " Press Ctrl+C to stop"
  22. echo ""
  23. cd "$SCRIPT_DIR"
  24. # Detect platform and set appropriate Qt backend
  25. if [[ "$OSTYPE" == "darwin"* ]]; then
  26. # macOS - use native cocoa backend (default, no need to set)
  27. echo " Platform: macOS (using native cocoa backend)"
  28. export QT_QPA_PLATFORM="" # Let Qt use default
  29. elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
  30. # Linux - check for DRM devices to determine if eglfs is available
  31. if [ -e /dev/dri/card0 ] || [ -e /dev/dri/card1 ]; then
  32. echo " Platform: Linux with DRM (using eglfs backend)"
  33. export QT_QPA_PLATFORM=eglfs
  34. export QT_QPA_EGLFS_INTEGRATION=eglfs_kms
  35. export QT_QPA_EGLFS_KMS_ATOMIC=1
  36. export QT_QPA_EGLFS_HIDECURSOR=1
  37. export QT_QPA_EGLFS_ALWAYS_SET_MODE=1
  38. # Use eglfs_config.json if available
  39. if [ -f "$SCRIPT_DIR/eglfs_config.json" ]; then
  40. echo " Using eglfs config: $SCRIPT_DIR/eglfs_config.json"
  41. export QT_QPA_EGLFS_KMS_CONFIG="$SCRIPT_DIR/eglfs_config.json"
  42. fi
  43. else
  44. echo " Platform: Linux without DRM (using xcb/X11 backend)"
  45. export QT_QPA_PLATFORM=xcb
  46. fi
  47. else
  48. echo " Platform: Unknown (using default Qt backend)"
  49. fi
  50. exec ./venv/bin/python main.py