diff --git a/src/apprt/gtk/class/application.zig b/src/apprt/gtk/class/application.zig index 6ab3ad282..f7ed0d38c 100644 --- a/src/apprt/gtk/class/application.zig +++ b/src/apprt/gtk/class/application.zig @@ -524,13 +524,19 @@ pub const Application = extern struct { if (!config.@"quit-after-last-window-closed") break :q false; // If the quit timer has expired, quit. - if (priv.quit_timer == .expired) break :q true; + if (priv.quit_timer == .expired) { + log.debug("must_quit due to quit timer expired", .{}); + break :q true; + } // If we have no windows attached to our app, also quit. if (priv.requested_window and @as( ?*glib.List, self.as(gtk.Application).getWindows(), - ) == null) break :q true; + ) == null) { + log.debug("must_quit due to no app windows", .{}); + break :q true; + } // No quit conditions met break :q false; diff --git a/src/apprt/gtk/class/window.zig b/src/apprt/gtk/class/window.zig index df6ea647f..c0dd6ab1f 100644 --- a/src/apprt/gtk/class/window.zig +++ b/src/apprt/gtk/class/window.zig @@ -1489,6 +1489,13 @@ pub const Window = extern struct { const priv = self.private(); if (priv.tab_view.getNPages() == 0) { // If we have no pages left then we want to close window. + + // If the tab overview is open, then we don't close the window + // because its a rather abrupt experience. This also fixes an + // issue where dragging out the last tab in the tab overview + // won't cause Ghostty to exit. + if (priv.tab_overview.getOpen() != 0) return; + self.as(gtk.Window).close(); } }