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) return String(cString: ptr)
} }
var macosTitlebarProxyIcon: String { var macosTitlebarProxyIcon: Ghostty.MacOSTitlebarProxyIcon {
let defaultValue = "visible" let defaultValue = Ghostty.MacOSTitlebarProxyIcon.visible
guard let config = self.config else { return defaultValue } guard let config = self.config else { return defaultValue }
var v: UnsafePointer<Int8>? = nil var v: UnsafePointer<Int8>? = nil
let key = "macos-titlebar-proxy-icon" let key = "macos-titlebar-proxy-icon"
guard ghostty_config_get(config, &v, key, UInt(key.count)) else { return defaultValue } guard ghostty_config_get(config, &v, key, UInt(key.count)) else { return defaultValue }
guard let ptr = v 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 { 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 // MARK: Surface Notifications