Skip to content

Commit fe7e858

Browse files
authored
Merge pull request #47 from VariableThe/fix/macos-window-shift
fix: compensate for macOS frameless window shift down bug on restart
2 parents b78b3dc + f4fdbc5 commit fe7e858

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src-tauri/src/lib.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,16 @@ pub fn run() {
5252
use tauri::Manager;
5353
if let Some(window) = app.get_webview_window("main") {
5454
#[cfg(target_os = "macos")]
55-
crate::macos::set_move_to_active_space(&window);
55+
{
56+
crate::macos::set_move_to_active_space(&window);
57+
58+
// Fix for macOS frameless window walking down on restart
59+
// tauri-plugin-window-state restores position with titlebar offset
60+
if let Ok(mut pos) = window.outer_position() {
61+
pos.y = pos.y.saturating_sub(28);
62+
let _ = window.set_position(tauri::Position::Physical(pos));
63+
}
64+
}
5665

5766
let dialog_state = app.state::<crate::DialogState>();
5867
let is_dialog_open = dialog_state.is_open.clone();

0 commit comments

Comments
 (0)