From e95645731e09fcb4643839299737a262ca33c05a Mon Sep 17 00:00:00 2001 From: Aditya Date: Thu, 25 Jun 2026 15:41:00 +0530 Subject: [PATCH] fix: remove macOS frameless window 28px shift compensation The tauri-plugin-window-state v2.4.1 has no macOS-specific offset for frameless windows - it correctly uses outer_position() for saving and set_position() for restoring. The 28px compensation was added for a bug in an older plugin version that no longer applies. On macOS frameless windows (decorations: false), outer_position() returns the window frame origin which equals the content origin since there is no titlebar. The compensation was causing the saved position to be offset by 28px, leading to the window appearing lower on restart when the correction failed to apply. This removes all +/-28 compensation from both save (quit_app) and restore (lib.rs setup thread, restore_window_state command) paths. --- src-tauri/src/commands/system.rs | 7 ------- src-tauri/src/lib.rs | 5 ----- 2 files changed, 12 deletions(-) diff --git a/src-tauri/src/commands/system.rs b/src-tauri/src/commands/system.rs index 74510c1..9c4cd50 100644 --- a/src-tauri/src/commands/system.rs +++ b/src-tauri/src/commands/system.rs @@ -53,13 +53,6 @@ pub fn restore_window_state(app: AppHandle) -> Result<(), String> { } } } - #[cfg(target_os = "macos")] - { - if let Ok(mut pos) = window.outer_position() { - pos.y = pos.y.saturating_sub(28); - let _ = window.set_position(tauri::Position::Physical(pos)); - } - } } Ok(()) } diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 63bdcf2..e1265ff 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -131,11 +131,6 @@ pub fn run() { } } } - #[cfg(target_os = "macos")] - if let Ok(mut pos) = win.outer_position() { - pos.y = pos.y.saturating_sub(28); - let _ = win.set_position(tauri::Position::Physical(pos)); - } }); }); } else {