folder增加项目启动器入口,优化窗口跳转

This commit is contained in:
xintaofei
2026-03-27 15:25:55 +08:00
parent 3b080c801b
commit ea77c5b0e8
20 changed files with 81 additions and 39 deletions

View File

@@ -610,13 +610,22 @@ pub async fn open_push_window(
}
#[tauri::command]
pub async fn open_project_boot_window(app: AppHandle) -> Result<(), AppCommandError> {
pub async fn open_project_boot_window(
app: AppHandle,
source: Option<String>,
) -> Result<(), AppCommandError> {
if let Some(existing) = app.get_webview_window("project-boot") {
ensure_windows_undecorated(&existing);
let _ = existing.unminimize();
existing.set_focus().map_err(|e| {
AppCommandError::window("Failed to focus project boot window", e.to_string())
})?;
// Close welcome if opened from welcome
if source.as_deref() == Some("welcome") {
if let Some(w) = app.get_webview_window("welcome") {
let _ = w.close();
}
}
return Ok(());
}
@@ -633,5 +642,12 @@ pub async fn open_project_boot_window(app: AppHandle) -> Result<(), AppCommandEr
})?;
ensure_windows_undecorated(&window);
// Close welcome if opened from welcome
if source.as_deref() == Some("welcome") {
if let Some(w) = app.get_webview_window("welcome") {
let _ = w.close();
}
}
Ok(())
}

View File

@@ -140,6 +140,24 @@ pub fn run() {
});
}
if label == "project-boot"
&& matches!(
event,
tauri::WindowEvent::CloseRequested { .. } | tauri::WindowEvent::Destroyed
)
{
let app = window.app_handle();
if !APP_QUITTING.load(Ordering::Relaxed) {
let has_other = app
.webview_windows()
.keys()
.any(|l| *l != label && *l != "settings");
if !has_other {
let _ = windows::open_welcome_window(app);
}
}
}
if let tauri::WindowEvent::CloseRequested { .. } = event {
if label.starts_with("folder-") {
let app = window.app_handle();