config: add quit-after-last-window-closed

Whether or not to quit after the last window is closed. This defaults
to false. Currently only supported on macOS.
This commit is contained in:
Jon Parise
2023-10-18 12:46:35 -07:00
parent 0eea5f00e2
commit 17b63f7617
3 changed files with 18 additions and 1 deletions

View File

@@ -81,7 +81,11 @@ class AppDelegate: NSObject, ObservableObject, NSApplicationDelegate, GhosttyApp
// else is initialized.
NSApp.servicesProvider = ServiceProvider()
}
func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
return ghostty.shouldQuitAfterLastWindowClosed
}
func applicationShouldTerminate(_ sender: NSApplication) -> NSApplication.TerminateReply {
let windows = NSApplication.shared.windows
if (windows.isEmpty) { return .terminateNow }