mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-19 22:10:29 +00:00
fix(macos): address MR feedback #5939
This commit is contained in:
@@ -59,6 +59,11 @@ class QuickTerminalController: BaseTerminalController {
|
||||
selector: #selector(ghosttyConfigDidChange(_:)),
|
||||
name: .ghosttyConfigDidChange,
|
||||
object: nil)
|
||||
center.addObserver(
|
||||
self,
|
||||
selector: #selector(onNewTab),
|
||||
name: Ghostty.Notification.ghosttyNewTab,
|
||||
object: nil)
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
@@ -496,6 +501,14 @@ class QuickTerminalController: BaseTerminalController {
|
||||
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 {
|
||||
let quickTerminalScreen: QuickTerminalScreen
|
||||
let quickTerminalAnimationDuration: Double
|
||||
|
||||
@@ -125,11 +125,8 @@ class TerminalManager {
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
// Making sure that we're dealing with a TerminalController
|
||||
guard parent.windowController is TerminalController else { return }
|
||||
|
||||
// If our parent is in non-native fullscreen, then new tabs do not work.
|
||||
// See: https://github.com/mitchellh/ghostty/issues/392
|
||||
|
||||
Reference in New Issue
Block a user