feat: focus terminal in basic cases

This commit is contained in:
himura467
2025-09-28 19:20:00 +09:00
parent e4e8a61e0c
commit 9d33545a55
2 changed files with 45 additions and 0 deletions

View File

@@ -233,6 +233,16 @@ class BaseTerminalController: NSWindowController,
return newView
}
func focusSurface(_ view: Ghostty.SurfaceView) {
guard surfaceTree.contains(view) else { return }
DispatchQueue.main.async {
Ghostty.moveFocus(to: view, from: self.focusedSurface)
view.window?.makeKeyAndOrderFront(nil)
NSApp.activate(ignoringOtherApps: true)
}
}
/// Called when the surfaceTree variable changed.
///
/// Subclasses should call super first.