diff --git a/desktop/src-tauri/src/lib.rs b/desktop/src-tauri/src/lib.rs index 18c987c48c..6630a67a58 100644 --- a/desktop/src-tauri/src/lib.rs +++ b/desktop/src-tauri/src/lib.rs @@ -84,16 +84,14 @@ pub fn run() { .plugin(tauri_plugin_opener::init()) .plugin( tauri_plugin_window_state::Builder::default() - // The main window should always launch edge-to-edge in the - // available desktop area. Do not let stale saved geometry or - // fullscreen state override the maximized launch config. + // Restore the user's window size/position (and maximized + // state) across launches. First launch falls back to the + // centered default bounds in tauri.conf.json instead of + // opening edge-to-edge. Visibility stays managed by the app + // (window is revealed once React mounts) and fullscreen is + // never restored — relaunching into fullscreen is jarring. .with_state_flags( - StateFlags::all() - & !(StateFlags::VISIBLE - | StateFlags::POSITION - | StateFlags::SIZE - | StateFlags::MAXIMIZED - | StateFlags::FULLSCREEN), + StateFlags::all() & !(StateFlags::VISIBLE | StateFlags::FULLSCREEN), ) .build(), ) diff --git a/desktop/src-tauri/tauri.conf.json b/desktop/src-tauri/tauri.conf.json index 5e35cc6049..c2d090b4d1 100644 --- a/desktop/src-tauri/tauri.conf.json +++ b/desktop/src-tauri/tauri.conf.json @@ -17,9 +17,9 @@ "windows": [ { "title": "", - "width": 800, - "height": 600, - "maximized": true, + "width": 1280, + "height": 800, + "center": true, "visible": false, "titleBarStyle": "Overlay", "hiddenTitle": true, diff --git a/desktop/src/app/App.tsx b/desktop/src/app/App.tsx index 86bce83763..715c97a5b2 100644 --- a/desktop/src/app/App.tsx +++ b/desktop/src/app/App.tsx @@ -234,7 +234,11 @@ export function App() { useReloadShortcut(); useLayoutEffect(() => { - void getCurrentWindow().show(); + // The window starts hidden (visible: false in tauri.conf.json) so users + // never see an unstyled flash. Reveal it once React mounts, and focus it + // explicitly — show() alone can leave the window behind others on launch. + const appWindow = getCurrentWindow(); + void appWindow.show().then(() => appWindow.setFocus()); }, []); const [sharedIdentity, setSharedIdentity] = useState(null);