From 61dd395251ef57c1bd58254e1a6244e172443a4d Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 28 Sep 2024 18:46:45 -0700 Subject: [PATCH] macos: show alert if new tab is attempted from quick term --- .../QuickTerminal/QuickTerminalController.swift | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/macos/Sources/Features/QuickTerminal/QuickTerminalController.swift b/macos/Sources/Features/QuickTerminal/QuickTerminalController.swift index 979af1fca..698be98bc 100644 --- a/macos/Sources/Features/QuickTerminal/QuickTerminalController.swift +++ b/macos/Sources/Features/QuickTerminal/QuickTerminalController.swift @@ -57,6 +57,11 @@ class QuickTerminalController: BaseTerminalController { override func windowDidResignKey(_ notification: 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() } @@ -178,4 +183,14 @@ class QuickTerminalController: BaseTerminalController { // Instead of closing the window, we animate it out. 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) + } }