@@ -28,7 +28,7 @@ pub struct App { |
| 28 | 28 | |
| 29 | 29 | impl App { |
| 30 | 30 | /// Create a new application instance. |
| 31 | | - pub fn new(config: Config) -> Result<Self> { |
| 31 | + pub fn new(config: Config, demo: bool) -> Result<Self> { |
| 32 | 32 | // Connect to X11 |
| 33 | 33 | let conn = Connection::connect(None)?; |
| 34 | 34 | tracing::info!("connected to X11 display"); |
@@ -80,9 +80,14 @@ impl App { |
| 80 | 80 | let view_rect = Rect::new(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT - 100); // Leave room for controls |
| 81 | 81 | let mut monitor_view = MonitorView::new(view_rect); |
| 82 | 82 | |
| 83 | | - // Detect monitors |
| 84 | | - let monitors = detect_monitors(&conn)?; |
| 85 | | - tracing::info!("detected {} monitors", monitors.len()); |
| 83 | + // Detect or create demo monitors |
| 84 | + let monitors = if demo { |
| 85 | + tracing::info!("demo mode: using fake monitors"); |
| 86 | + Self::demo_monitors() |
| 87 | + } else { |
| 88 | + detect_monitors(&conn)? |
| 89 | + }; |
| 90 | + tracing::info!("using {} monitors", monitors.len()); |
| 86 | 91 | for m in &monitors { |
| 87 | 92 | tracing::debug!( |
| 88 | 93 | " {} {}x{} at ({}, {}) {}", |
@@ -107,6 +112,33 @@ impl App { |
| 107 | 112 | }) |
| 108 | 113 | } |
| 109 | 114 | |
| 115 | + /// Create demo monitors for UI testing. |
| 116 | + fn demo_monitors() -> Vec<gartk_x11::Monitor> { |
| 117 | + vec![ |
| 118 | + gartk_x11::Monitor { |
| 119 | + name: "eDP-1".to_string(), |
| 120 | + rect: Rect::new(0, 0, 2560, 1600), |
| 121 | + primary: true, |
| 122 | + width_mm: 290, |
| 123 | + height_mm: 180, |
| 124 | + }, |
| 125 | + gartk_x11::Monitor { |
| 126 | + name: "HDMI-1".to_string(), |
| 127 | + rect: Rect::new(2560, 0, 1920, 1080), |
| 128 | + primary: false, |
| 129 | + width_mm: 530, |
| 130 | + height_mm: 300, |
| 131 | + }, |
| 132 | + gartk_x11::Monitor { |
| 133 | + name: "DP-1".to_string(), |
| 134 | + rect: Rect::new(2560, 1080, 1920, 1080), |
| 135 | + primary: false, |
| 136 | + width_mm: 530, |
| 137 | + height_mm: 300, |
| 138 | + }, |
| 139 | + ] |
| 140 | + } |
| 141 | + |
| 110 | 142 | /// Run the application event loop. |
| 111 | 143 | pub fn run(&mut self) -> Result<()> { |
| 112 | 144 | // Initial render |