mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
Fix new tab not created on Quick Terminal
This commit is contained in:
@ -68,7 +68,7 @@ class QuickTerminalController: BaseTerminalController {
|
|||||||
object: nil)
|
object: nil)
|
||||||
center.addObserver(
|
center.addObserver(
|
||||||
self,
|
self,
|
||||||
selector: #selector(onNewTab(_:)),
|
selector: #selector(onNewTab),
|
||||||
name: Ghostty.Notification.ghosttyNewTab,
|
name: Ghostty.Notification.ghosttyNewTab,
|
||||||
object: nil)
|
object: nil)
|
||||||
center.addObserver(
|
center.addObserver(
|
||||||
@ -539,7 +539,13 @@ class QuickTerminalController: BaseTerminalController {
|
|||||||
syncAppearance()
|
syncAppearance()
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc func onNewTab(_ sender: Any?) {
|
@objc func onNewTab(notification: SwiftUI.Notification) {
|
||||||
|
guard let surfaceView = notification.object as? Ghostty.SurfaceView else { return }
|
||||||
|
guard let window = surfaceView.window else { return }
|
||||||
|
|
||||||
|
// return if window is not in our managed windows
|
||||||
|
guard window == self.window else { return }
|
||||||
|
|
||||||
tabManager.newTab()
|
tabManager.newTab()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -329,6 +329,9 @@ class TerminalManager {
|
|||||||
guard let surfaceView = notification.object as? Ghostty.SurfaceView else { return }
|
guard let surfaceView = notification.object as? Ghostty.SurfaceView else { return }
|
||||||
guard let window = surfaceView.window else { return }
|
guard let window = surfaceView.window else { return }
|
||||||
|
|
||||||
|
// return if window is not in our managed windows
|
||||||
|
guard windows.contains(where: { $0.controller.window == window }) else { return }
|
||||||
|
|
||||||
let configAny = notification.userInfo?[Ghostty.Notification.NewSurfaceConfigKey]
|
let configAny = notification.userInfo?[Ghostty.Notification.NewSurfaceConfigKey]
|
||||||
let config = configAny as? Ghostty.SurfaceConfiguration
|
let config = configAny as? Ghostty.SurfaceConfiguration
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user