Skip to content

Commit

The desktop app's window no longer gets the system's frame back from an earlier run.

The window-state plugin kept whether the window had the system's frame, and restoring it at the start put Windows' title bar back round g1t's own on any machine that had run a version with the frame. The window keeps its size, place, and maximized and full screen state; its frame is the title bar setting's alone.

Claude-Session:
https://claude.ai/code/session_01MMRPpook51KPMQQRurb5kC
Claudeagent and Claudeagentcommitted Parent5c1baecBrowse files
1 file+16−30/1 viewed
+16−3
2626 use tauri::{RunEvent, WebviewUrl, WebviewWindowBuilder, WindowEvent};
2727 use tauri_plugin_window_state::{StateFlags, WindowExt};
2828
29+/// What the window keeps between launches: its size, place, and whether it
30+/// was maximized or full screen; not its frame.
31+const KEPT: StateFlags = StateFlags::all().difference(StateFlags::DECORATIONS);
32+
2933 /// The one window's label.
3034 pub const WINDOW: &str = "main";
3135
4044 .plugin(tauri_plugin_opener::init())
4145 .plugin(tauri_plugin_updater::Builder::new().build())
4246 // The window's size and place come back in setup, without the plugin
43− // also showing it: at sign-in g1t may start in the tray.
44− .plugin(tauri_plugin_window_state::Builder::new().skip_initial_state(WINDOW).with_denylist(&[settings::SETTINGS]).build())
47+ // also showing it: at sign-in g1t may start in the tray. Whether it
48+ // has the system's frame is the title bar setting's (frame.rs), never
49+ // what an earlier run left: kept, it would put the frame back round
50+ // g1t's own title bar.
51+ .plugin(
52+ tauri_plugin_window_state::Builder::new()
53+ .with_state_flags(KEPT)
54+ .skip_initial_state(WINDOW)
55+ .with_denylist(&[settings::SETTINGS])
56+ .build(),
57+ )
4558 // Opening at sign-in, which settings turn on; the argument tells that start from someone's.
4659 .plugin(tauri_plugin_autostart::init(tauri_plugin_autostart::MacosLauncher::LaunchAgent, Some(vec![settings::AT_LOGIN])))
4760 .manage(config::State::default())
93106 let builder = builder.menu(menu::build(&handle)?);
94107 let window = frame::style(builder, custom).build()?;
95108 // Opened at sign-in, g1t waits in the tray; otherwise the window comes up where it was.
96− let _ = window.restore_state(StateFlags::all() - StateFlags::VISIBLE);
109+ let _ = window.restore_state(KEPT - StateFlags::VISIBLE);
97110 #[cfg(not(target_os = "macos"))]
98111 frame::menu_bar(&window, custom);
99112 if !hidden {