fix(macos): address MR feedback #5939

pull/5955/head
McNight 2025-02-25 00:17:01 +01:00
parent aa4aaa200f
commit 1254c6b981
2 changed files with 15 additions and 5 deletions

View File

@ -59,6 +59,11 @@ class QuickTerminalController: BaseTerminalController {
selector: #selector(ghosttyConfigDidChange(_:)), selector: #selector(ghosttyConfigDidChange(_:)),
name: .ghosttyConfigDidChange, name: .ghosttyConfigDidChange,
object: nil) object: nil)
center.addObserver(
self,
selector: #selector(onNewTab),
name: Ghostty.Notification.ghosttyNewTab,
object: nil)
} }
required init?(coder: NSCoder) { required init?(coder: NSCoder) {
@ -496,6 +501,14 @@ class QuickTerminalController: BaseTerminalController {
syncAppearance() syncAppearance()
} }
@objc private func onNewTab(notification: SwiftUI.Notification) {
guard let surfaceView = notification.object as? Ghostty.SurfaceView else { return }
guard let window = surfaceView.window else { return }
guard window.windowController is QuickTerminalController else { return }
// Tabs aren't supported with Quick Terminals or derivatives
showNoNewTabAlert()
}
private struct DerivedConfig { private struct DerivedConfig {
let quickTerminalScreen: QuickTerminalScreen let quickTerminalScreen: QuickTerminalScreen
let quickTerminalAnimationDuration: Double let quickTerminalAnimationDuration: Double

View File

@ -125,11 +125,8 @@ 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. // Making sure that we're dealing with a TerminalController
if let controller = parent.windowController as? QuickTerminalController { guard parent.windowController is TerminalController else { return }
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