fix(window): quit when the last window is closed from the home page

Closing the window with zero tabs took the early-return path in
on_window_should_close, which skipped the cx.quit() the confirmed path
runs. gpui does not quit on last-window-close and no on_reopen handler is
registered, so the process stayed alive with no window and clicking the
Dock icon did nothing (#147). Defer the quit onto the next tick so the
close completes first, matching the confirmed path.
This commit is contained in:
l0ng-ai
2026-07-22 21:04:40 +08:00
parent b98e9c4ea5
commit 0e76a79685
+10 -1
View File
@@ -698,11 +698,20 @@ impl Tty7App {
return true;
}
// From the home page (zero tabs) there are no running sessions to
// reassure about — prompting would be pure friction. Close directly.
// reassure about — prompting would be pure friction. Close directly,
// but still quit with the window: closing our only window without
// quitting leaves a windowless process sitting in the Dock that no
// longer responds to being clicked (#147). Deferred onto the next
// tick so the close itself completes first, same as the confirmed
// path below.
if weak_app
.upgrade()
.is_some_and(|app| app.read(cx).tabs.is_empty())
{
cx.spawn(async move |cx| {
let _ = cx.update(|cx| cx.quit());
})
.detach();
return true;
}
let answer = window.prompt(