mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
macos: background-opacity getter
This commit is contained in:
@ -16,6 +16,14 @@ class FocusedSurfaceWrapper {
|
|||||||
class PrimaryWindow: NSWindow {
|
class PrimaryWindow: NSWindow {
|
||||||
var focusedSurfaceWrapper: FocusedSurfaceWrapper = FocusedSurfaceWrapper()
|
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 {
|
static func create(ghostty: Ghostty.AppState, appDelegate: AppDelegate, baseConfig: ghostty_surface_config_s? = nil) -> PrimaryWindow {
|
||||||
let window = PrimaryWindow(
|
let window = PrimaryWindow(
|
||||||
contentRect: NSRect(x: 0, y: 0, width: 800, height: 600),
|
contentRect: NSRect(x: 0, y: 0, width: 800, height: 600),
|
||||||
@ -53,12 +61,4 @@ class PrimaryWindow: NSWindow {
|
|||||||
|
|
||||||
return mask
|
return mask
|
||||||
}
|
}
|
||||||
|
|
||||||
override var canBecomeKey: Bool {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
override var canBecomeMain: Bool {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -82,6 +82,15 @@ extension Ghostty {
|
|||||||
return String(cString: ptr)
|
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() {
|
init() {
|
||||||
// Initialize ghostty global state. This happens once per process.
|
// Initialize ghostty global state. This happens once per process.
|
||||||
guard ghostty_init() == GHOSTTY_SUCCESS else {
|
guard ghostty_init() == GHOSTTY_SUCCESS else {
|
||||||
|
Reference in New Issue
Block a user