diff --git a/macos/Sources/Features/Primary Window/PrimaryWindow.swift b/macos/Sources/Features/Primary Window/PrimaryWindow.swift index 51194ad91..0b199921b 100644 --- a/macos/Sources/Features/Primary Window/PrimaryWindow.swift +++ b/macos/Sources/Features/Primary Window/PrimaryWindow.swift @@ -15,6 +15,14 @@ class FocusedSurfaceWrapper { // such as non-native fullscreen. class PrimaryWindow: NSWindow { var focusedSurfaceWrapper: FocusedSurfaceWrapper = FocusedSurfaceWrapper() + + override var canBecomeKey: Bool { + return true + } + + override var canBecomeMain: Bool { + return true + } static func create(ghostty: Ghostty.AppState, appDelegate: AppDelegate, baseConfig: ghostty_surface_config_s? = nil) -> PrimaryWindow { let window = PrimaryWindow( @@ -53,12 +61,4 @@ class PrimaryWindow: NSWindow { return mask } - - override var canBecomeKey: Bool { - return true - } - - override var canBecomeMain: Bool { - return true - } } diff --git a/macos/Sources/Ghostty/AppState.swift b/macos/Sources/Ghostty/AppState.swift index 9e7674a25..55a5b7b50 100644 --- a/macos/Sources/Ghostty/AppState.swift +++ b/macos/Sources/Ghostty/AppState.swift @@ -81,7 +81,16 @@ extension Ghostty { guard let ptr = v else { return nil } return String(cString: ptr) } - + + /// The background opacity. + var backgroundOpacity: Double { + guard let config = self.config else { return 1 } + var v: Double = 1 + let key = "background-opacity" + _ = ghostty_config_get(config, &v, key, UInt(key.count)) + return v; + } + init() { // Initialize ghostty global state. This happens once per process. guard ghostty_init() == GHOSTTY_SUCCESS else {