macos: integrate needsConfirmQuit to quit if all windows are at prompt

This commit is contained in:
Mitchell Hashimoto
2023-09-11 15:44:28 -07:00
parent 56ccadd7f1
commit 999d17c49d
2 changed files with 9 additions and 0 deletions

View File

@ -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

View File

@ -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