From da80531c2222a7d0004cea1a5a3238f995ef482e Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Sat, 4 Jan 2025 23:49:27 +0100 Subject: [PATCH 1/2] Implement configuration option split-divider-color for macOS --- macos/Sources/Ghostty/Ghostty.Config.swift | 15 ++++++++++++++- src/config/Config.zig | 4 ++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/macos/Sources/Ghostty/Ghostty.Config.swift b/macos/Sources/Ghostty/Ghostty.Config.swift index b6da07612..0c1f4e07a 100644 --- a/macos/Sources/Ghostty/Ghostty.Config.swift +++ b/macos/Sources/Ghostty/Ghostty.Config.swift @@ -381,7 +381,20 @@ extension Ghostty { let backgroundColor = OSColor(backgroundColor) let isLightBackground = backgroundColor.isLightColor let newColor = isLightBackground ? backgroundColor.darken(by: 0.08) : backgroundColor.darken(by: 0.4) - return Color(newColor) + + guard let config = self.config else { return Color(newColor) } + + var color: ghostty_config_color_s = .init(); + let key = "split-divider-color" + if (!ghostty_config_get(config, &color, key, UInt(key.count))) { + return Color(newColor) + } + + return .init( + red: Double(color.r) / 255, + green: Double(color.g) / 255, + blue: Double(color.b) / 255 + ) } #if canImport(AppKit) diff --git a/src/config/Config.zig b/src/config/Config.zig index cade03734..6fc9ddf9e 100644 --- a/src/config/Config.zig +++ b/src/config/Config.zig @@ -610,8 +610,8 @@ palette: Palette = .{}, /// Specified as either hex (`#RRGGBB` or `RRGGBB`) or a named X11 color. @"unfocused-split-fill": ?Color = null, -/// The color of the divider between splits. If unset the default system color -/// will be used. GTK only. +/// The color of the split divider. If this is not set, a default will be chosen. +/// Specified as either hex (`#RRGGBB` or `RRGGBB`) or a named X11 color. @"split-divider-color": ?Color = null, /// The command to run, usually a shell. If this is not an absolute path, it'll From a670836d7abc1e7e377d6af7c599fe433a387cd1 Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Sun, 5 Jan 2025 00:44:41 +0100 Subject: [PATCH 2/2] Remove outdated comment --- macos/Sources/Ghostty/Ghostty.Config.swift | 2 -- 1 file changed, 2 deletions(-) diff --git a/macos/Sources/Ghostty/Ghostty.Config.swift b/macos/Sources/Ghostty/Ghostty.Config.swift index 0c1f4e07a..ed9364914 100644 --- a/macos/Sources/Ghostty/Ghostty.Config.swift +++ b/macos/Sources/Ghostty/Ghostty.Config.swift @@ -375,8 +375,6 @@ extension Ghostty { ) } - // This isn't actually a configurable value currently but it could be done day. - // We put it here because it is a color that changes depending on the configuration. var splitDividerColor: Color { let backgroundColor = OSColor(backgroundColor) let isLightBackground = backgroundColor.isLightColor