config: macos-titlebar-style, remove titlebar-tabs option

Fixes #1833

This is an attempt to simplify the logic that has organically grown
convoluted over time with regards to how the titlebar and tab bar is
styled.

This field is one unified field that ONLY addresses titlebar and tab bar
styling. It can be one of "native", "transparent", or "tabs". The
"native" field is the new behavior in this commit: it makes the titlebar
and tab bar appearance be absolutely native. We do not color anything
(if we do its a bug).

The "transparent" option is the previous `macos-titlebar-tabs = false`
setting where the titlebar/tab bar is native but colored according to
the window background color.

The "tabs" option is `macos-titlebar-tabs = true`.

The `window-theme = auto` affect on titlebar appearance has been
removed. Now, the titlebar will NEVER be styled with "native" and MAY be
styled with "transparent" and will ALWAYS be styled with "tabs" (since
that's a totally custom look anyways).
This commit is contained in:
Mitchell Hashimoto
2024-06-07 12:12:48 -07:00
parent 54ccefe838
commit 4dde7edfab
4 changed files with 47 additions and 30 deletions

View File

@@ -228,12 +228,14 @@ extension Ghostty {
return String(cString: ptr)
}
var macosTitlebarTabs: Bool {
guard let config = self.config else { return false }
var v = false;
let key = "macos-titlebar-tabs"
_ = ghostty_config_get(config, &v, key, UInt(key.count))
return v
var macosTitlebarStyle: String {
let defaultValue = "transparent"
guard let config = self.config else { return defaultValue }
var v: UnsafePointer<Int8>? = nil
let key = "macos-titlebar-style"
guard ghostty_config_get(config, &v, key, UInt(key.count)) else { return defaultValue }
guard let ptr = v else { return defaultValue }
return String(cString: ptr)
}
var backgroundColor: Color {