macos: show alert if new tab is attempted from quick term

This commit is contained in:
Mitchell Hashimoto
2024-09-28 18:46:45 -07:00
parent 11d5ec7dc1
commit 61dd395251

View File

@ -57,6 +57,11 @@ class QuickTerminalController: BaseTerminalController {
override func windowDidResignKey(_ notification: Notification) { override func windowDidResignKey(_ notification: Notification) {
super.windowDidResignKey(notification) super.windowDidResignKey(notification)
// We don't animate out if there is a modal sheet being shown currently.
// This lets us show alerts without causing the window to disappear.
guard window?.attachedSheet == nil else { return }
animateOut() animateOut()
} }
@ -178,4 +183,14 @@ class QuickTerminalController: BaseTerminalController {
// Instead of closing the window, we animate it out. // Instead of closing the window, we animate it out.
animateOut() animateOut()
} }
@IBAction func newTab(_ sender: Any?) {
guard let window else { return }
let alert = NSAlert()
alert.messageText = "Cannot Create New Tab"
alert.informativeText = "Tabs aren't supported in the Quick Terminal."
alert.addButton(withTitle: "OK")
alert.alertStyle = .warning
alert.beginSheetModal(for: window)
}
} }