Fix: Remove primary_monitor() API - use fixed position for overlay

This commit is contained in:
Aether 2026-02-23 21:47:47 +00:00
parent aa9af2a735
commit 22230df27f
No known key found for this signature in database
GPG Key ID: 95AFEE837E39AFD2
1 changed files with 6 additions and 10 deletions

View File

@ -15,20 +15,16 @@ pub fn create_main_window(app: &AppHandle) -> Window {
.expect("Failed to create main window") .expect("Failed to create main window")
} }
pub fn setup_main_window(window: &Window) { pub fn setup_main_window(_window: &Window) {
info!("Main window setup complete"); info!("Main window setup complete");
} }
pub fn create_overlay_window(app: &AppHandle) { pub fn create_overlay_window(app: &AppHandle) {
// Get primary monitor size // Position overlay at bottom center (fixed position, centered on 1920x1080)
let monitor = app.primary_monitor().unwrap();
let monitor_size = monitor.as_ref().map(|m| m.size()).unwrap_or_else(|| tauri::PhysicalSize::new(1920, 1080));
// Position overlay at bottom center like Windows Start Menu
let window_width = 720.0; let window_width = 720.0;
let window_height = 600.0; // Expanded height let window_height = 600.0;
let x = (monitor_size.width as f64 - window_width) / 2.0; let x = (1920.0 - window_width) / 2.0; // Center on 1920px width
let y = monitor_size.height as f64 - window_height - 20.0; // 20px from bottom let y = 1080.0 - window_height - 40.0; // 40px from bottom on 1080px height
let _window = WindowBuilder::new( let _window = WindowBuilder::new(
app, app,
@ -46,7 +42,7 @@ pub fn create_overlay_window(app: &AppHandle) {
.build() .build()
.expect("Failed to create overlay window"); .expect("Failed to create overlay window");
info!("Overlay window created at bottom center (Windows-style)"); info!("Overlay window created at bottom center");
} }
pub fn toggle_overlay_window(app: &AppHandle) { pub fn toggle_overlay_window(app: &AppHandle) {