gtk(wayland): implement server-side decorations

This commit is contained in:
Leah Amelia Chen
2025-01-06 21:58:22 +01:00
committed by Mitchell Hashimoto
parent d1fd22ae80
commit 4e0d9b1b27
11 changed files with 294 additions and 76 deletions

View File

@@ -165,11 +165,14 @@ extension Ghostty {
}
var windowDecorations: Bool {
guard let config = self.config else { return true }
var v = false;
let defaultValue = true
guard let config = self.config else { return defaultValue }
var v: UnsafePointer<Int8>? = nil
let key = "window-decoration"
_ = ghostty_config_get(config, &v, key, UInt(key.count))
return v;
guard ghostty_config_get(config, &v, key, UInt(key.count)) else { return defaultValue }
guard let ptr = v else { return defaultValue }
let str = String(cString: ptr)
return WindowDecoration(rawValue: str)?.enabled() ?? defaultValue
}
var windowTheme: String? {
@@ -554,4 +557,17 @@ extension Ghostty.Config {
}
}
}
enum WindowDecoration: String {
case none
case client
case server
func enabled() -> Bool {
switch self {
case .client, .server: return true
case .none: return false
}
}
}
}