macos: little tweaks

This commit is contained in:
Mitchell Hashimoto
2023-03-07 22:09:39 -08:00
parent 508277f823
commit a754fe8c30
2 changed files with 16 additions and 1 deletions

View File

@ -46,6 +46,7 @@ extension Ghostty {
GeometryReader { geo in
Surface(view: surfaceView, hasFocus: hasFocus, size: geo.size)
.focused($surfaceFocus)
.focusedValue(\.ghosttySurfaceView, surfaceView)
.navigationTitle(surfaceView.title)
}
.ghosttySurfaceView(surfaceView)
@ -511,3 +512,17 @@ extension View {
environment(\.ghosttySurfaceView, surfaceView)
}
}
// MARK: Surface Focus Keys
extension FocusedValues {
var ghosttySurfaceView: Ghostty.SurfaceView? {
get { self[FocusedGhosttySurface.self] }
set { self[FocusedGhosttySurface.self] = newValue }
}
struct FocusedGhosttySurface: FocusedValueKey {
typealias Value = Ghostty.SurfaceView
}
}

View File

@ -11,7 +11,7 @@ struct GhosttyApp: App {
/// The ghostty global state. Only one per process.
@StateObject private var ghostty = Ghostty.AppState()
@NSApplicationDelegateAdaptor(AppDelegate.self) private var appDelegate;
@NSApplicationDelegateAdaptor(AppDelegate.self) private var appDelegate
var body: some Scene {
WindowGroup {