fix(macos): prevent performing newTab shortcut on QuickTerminalWindow #5939

This commit is contained in:
McNight
2025-02-23 19:34:27 +01:00
parent 2f63f840de
commit aa4aaa200f
2 changed files with 17 additions and 7 deletions

View File

@ -437,6 +437,16 @@ class QuickTerminalController: BaseTerminalController {
} }
} }
func showNoNewTabAlert() {
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)
}
// MARK: First Responder // MARK: First Responder
@IBAction override func closeWindow(_ sender: Any) { @IBAction override func closeWindow(_ sender: Any) {
@ -445,13 +455,7 @@ class QuickTerminalController: BaseTerminalController {
} }
@IBAction func newTab(_ sender: Any?) { @IBAction func newTab(_ sender: Any?) {
guard let window else { return } showNoNewTabAlert()
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)
} }
@IBAction func toggleGhosttyFullScreen(_ sender: Any) { @IBAction func toggleGhosttyFullScreen(_ sender: Any) {

View File

@ -125,6 +125,12 @@ class TerminalManager {
} }
private func newTab(to parent: NSWindow, withBaseConfig base: Ghostty.SurfaceConfiguration?) { private func newTab(to parent: NSWindow, withBaseConfig base: Ghostty.SurfaceConfiguration?) {
// If the parent window is a QuickTerminalWindow, we early return with an alert.
if let controller = parent.windowController as? QuickTerminalController {
controller.showNoNewTabAlert()
return
}
// If our parent is in non-native fullscreen, then new tabs do not work. // If our parent is in non-native fullscreen, then new tabs do not work.
// See: https://github.com/mitchellh/ghostty/issues/392 // See: https://github.com/mitchellh/ghostty/issues/392
if let controller = parent.windowController as? TerminalController, if let controller = parent.windowController as? TerminalController,