mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-09-15 15:58:20 +00:00
macos: use Ghostty.AppState as @EnvironmentObject
This is a small cleanup change. This provides the Ghostty.AppState object to any view that needs it within the TerminalSplit view hierarchy without needing to explicitly define EnvironmentKeys.
This commit is contained in:
@@ -4,11 +4,11 @@ import GhosttyKit
|
||||
extension Ghostty {
|
||||
/// Render a terminal for the active app in the environment.
|
||||
struct Terminal: View {
|
||||
@Environment(\.ghosttyApp) private var app
|
||||
@EnvironmentObject private var ghostty: Ghostty.AppState
|
||||
@FocusedValue(\.ghosttySurfaceTitle) private var surfaceTitle: String?
|
||||
|
||||
var body: some View {
|
||||
if let app = self.app {
|
||||
if let app = self.ghostty.app {
|
||||
SurfaceForApp(app) { surfaceView in
|
||||
SurfaceWrapper(surfaceView: surfaceView)
|
||||
}
|
||||
@@ -48,7 +48,7 @@ extension Ghostty {
|
||||
// Maintain whether our window has focus (is key) or not
|
||||
@State private var windowFocus: Bool = true
|
||||
|
||||
@Environment(\.ghosttyConfig) private var ghostty_config
|
||||
@EnvironmentObject private var ghostty: Ghostty.AppState
|
||||
|
||||
// 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.
|
||||
@@ -58,7 +58,7 @@ extension Ghostty {
|
||||
private var unfocusedOpacity: Double {
|
||||
var opacity: Double = 0.85
|
||||
let key = "unfocused-split-opacity"
|
||||
_ = ghostty_config_get(ghostty_config, &opacity, key, UInt(key.count))
|
||||
_ = ghostty_config_get(ghostty.config, &opacity, key, UInt(key.count))
|
||||
return 1 - opacity
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user