mirror of
https://github.com/l0ng-ai/tty7.git
synced 2026-09-22 08:02:24 +00:00
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:
+10
-1
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user