Summary of Fixes
- Window positioning and scaling
Updated _restore_window_geometry() to:
Validate saved window positions against all monitors
Center on the primary monitor if the saved position is off-screen
Ensure window size doesn't exceed screen dimensions
Handle multi-monitor setups
Removed redundant centering command from setup_window() since geometry restoration handles it - Overlay cleanup on close
Updated _on_window_close() to:
Check if overlay is active when the user clicks X
If active, call quit_app() to destroy the overlay, stop the tray, and clean up
If not active, hide to tray as before
Results:
The window opens centered on the primary monitor, even if the saved position is off-screen
Window size is constrained to fit the screen
Closing with X while overlay is active properly quits and cleans up the overlay
The application should now work correctly on laptops and other screen sizes, and the overlay cleanup issue is resolved.