fixed window size & position on macOS (real fullscreen now)
This commit is contained in:
@@ -118,18 +118,17 @@ fn start_scene_modifier_listener() {
|
|||||||
pub fn overlay_fullscreen(window: &tauri::Window) -> Result<(), tauri::Error> {
|
pub fn overlay_fullscreen(window: &tauri::Window) -> Result<(), tauri::Error> {
|
||||||
// Get the primary monitor
|
// Get the primary monitor
|
||||||
let monitor = get_app_handle().primary_monitor()?.unwrap();
|
let monitor = get_app_handle().primary_monitor()?.unwrap();
|
||||||
// Get the work area (usable space, excluding menu bar/dock/notch)
|
let monitor_size = monitor.size();
|
||||||
let work_area = monitor.work_area();
|
|
||||||
// Set window position to top-left of the work area
|
// Fullscreen the window by expanding the window to match monitor size then move it to the top-left corner
|
||||||
window.set_position(tauri::PhysicalPosition {
|
// This forces the window to fit under the notch that exists on MacBooks with a notch
|
||||||
x: work_area.position.x,
|
|
||||||
y: work_area.position.y,
|
|
||||||
})?;
|
|
||||||
// Set window size to match work area size
|
|
||||||
window.set_size(tauri::PhysicalSize {
|
window.set_size(tauri::PhysicalSize {
|
||||||
width: work_area.size.width,
|
width: monitor_size.width,
|
||||||
height: work_area.size.height,
|
height: monitor_size.height,
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
|
window.set_position(tauri::PhysicalPosition { x: 0, y: 0 })?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user