diff --git a/macos/Sources/AppDelegate.swift b/macos/Sources/AppDelegate.swift index 6785c3a30..e412de441 100644 --- a/macos/Sources/AppDelegate.swift +++ b/macos/Sources/AppDelegate.swift @@ -102,6 +102,9 @@ class AppDelegate: NSObject, ObservableObject, NSApplicationDelegate, GhosttyApp } } + // If our app says we don't need to confirm, we can exit now. + if (!ghostty.needsConfirmQuit) { return .terminateNow } + // We have some visible window, and all our windows will watch the confirmQuit. confirmQuit = true return .terminateLater diff --git a/macos/Sources/Ghostty/AppState.swift b/macos/Sources/Ghostty/AppState.swift index c714a4f40..99ddf04ac 100644 --- a/macos/Sources/Ghostty/AppState.swift +++ b/macos/Sources/Ghostty/AppState.swift @@ -40,6 +40,12 @@ extension Ghostty { } } + /// True if we need to confirm before quitting. + var needsConfirmQuit: Bool { + guard let app = app else { return false } + return ghostty_app_needs_confirm_quit(app) + } + /// Cached clipboard string for `read_clipboard` callback. private var cached_clipboard_string: String? = nil