From d9ff048a14c08b42c42b8c2e52b62a111f6bdcad Mon Sep 17 00:00:00 2001 From: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com> Date: Tue, 27 Oct 2026 22:20:25 +0800 Subject: [PATCH] feat(app): Closing the last project window shows the welcome screen --- src/features/app/closeGuard.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/features/app/closeGuard.ts b/src/features/app/closeGuard.ts index 2a0b1915c..45ed7bf60 100644 --- a/src/features/app/closeGuard.ts +++ b/src/features/app/closeGuard.ts @@ -9,7 +9,7 @@ */ import { commands, isTauri, onIdeEvent, type Settings } from "@/platform/ipc"; import { t } from "@/platform/i18n"; -import { provideLeaveProjectGuard, useProject } from "@/platform/project"; +import { closeProject, provideLeaveProjectGuard, useProject } from "@/platform/project"; import { maybeEditorService, notifications } from "@/workbench/contributions"; import { ask, type Ask } from "@/workbench/messages"; @@ -99,6 +99,12 @@ async function onCloseRequested(deps: CloseDeps): Promise { try { const ctx = await commands.windowCloseContext(); const s = useProject.getState(); + // Closing the last project window closes its project and shows the welcome screen + // (to open another one); closing the welcome screen, or quitting, closes the window. + if (!ctx.quitting && ctx.windows <= 1 && s.project) { + if (await confirmLeave(deps)) await closeProject(); + return false; + } const ok = await decideClose( { quitting: ctx.quitting,