feat(desktop): reserve right edge with Windows appbar

This commit is contained in:
2026-07-25 18:56:37 +08:00
parent 10790b233e
commit 794ec74c3f
5 changed files with 212 additions and 4 deletions

View File

@@ -1,7 +1,30 @@
#[cfg(windows)]
use tauri::Manager;
#[cfg(windows)]
mod windows_appbar;
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
tauri::Builder::default()
.plugin(tauri_plugin_opener::init())
.run(tauri::generate_context!())
.expect("启动森林AI时发生错误");
.setup(|app| {
#[cfg(windows)]
{
let window = app
.get_webview_window("main")
.expect("main window must be configured");
windows_appbar::register_right_edge(window.hwnd()?)?;
}
Ok(())
})
.build(tauri::generate_context!())
.expect("failed to build SenlinAI desktop app")
.run(|_, event| {
#[cfg(windows)]
if matches!(event, tauri::RunEvent::ExitRequested { .. }) {
windows_appbar::unregister();
}
});
}