mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-15 16:26:08 +03:00
21 lines
709 B
Swift
21 lines
709 B
Swift
import SwiftUI
|
|
import GhosttyKit
|
|
|
|
struct TerminalView: View {
|
|
let app: ghostty_app_t
|
|
@FocusState private var surfaceFocus: Bool
|
|
@Environment(\.isKeyWindow) private var isKeyWindow: Bool
|
|
@Environment(\.openWindow) private var openWindow
|
|
@State private var title: String = "Ghostty"
|
|
|
|
// This is true if the terminal is considered "focused". The terminal is focused if
|
|
// it is both individually focused and the containing window is key.
|
|
private var hasFocus: Bool { surfaceFocus && isKeyWindow }
|
|
|
|
var body: some View {
|
|
TerminalSurfaceView(app, hasFocus: hasFocus, title: $title)
|
|
.focused($surfaceFocus)
|
|
.navigationTitle(title)
|
|
}
|
|
}
|