Converted config declaration to an enum

This commit is contained in:
johnseth97
2024-10-24 23:02:50 -04:00
parent f78ddabc15
commit c3efda93f4
2 changed files with 11 additions and 3 deletions

View File

@ -229,14 +229,15 @@ extension Ghostty {
return String(cString: ptr)
}
var macosTitlebarProxyIcon: String {
let defaultValue = "visible"
var macosTitlebarProxyIcon: Ghostty.MacOSTitlebarProxyIcon {
let defaultValue = Ghostty.MacOSTitlebarProxyIcon.visible
guard let config = self.config else { return defaultValue }
var v: UnsafePointer<Int8>? = nil
let key = "macos-titlebar-proxy-icon"
guard ghostty_config_get(config, &v, key, UInt(key.count)) else { return defaultValue }
guard let ptr = v else { return defaultValue }
return String(cString: ptr)
let str = String(cString: ptr)
return Ghostty.MacOSTitlebarProxyIcon(rawValue: str) ?? defaultValue
}
var macosWindowShadow: Bool {

View File

@ -194,6 +194,13 @@ extension Ghostty {
}
}
}
/// Enum for the macos-titlebar-proxy-icon config option
enum MacOSTitlebarProxyIcon: String {
case visible
case hidden
}
}
// MARK: Surface Notifications