fix: disable renderer background when macOS effects are enabled
parent
d40af61960
commit
45aceace72
|
|
@ -480,7 +480,7 @@ class TerminalWindow: NSWindow {
|
|||
backgroundColor = .white.withAlphaComponent(0.001)
|
||||
|
||||
// Add liquid glass behind terminal content
|
||||
if #available(macOS 26.0, *), derivedConfig.macosBackgroundStyle != .blur {
|
||||
if #available(macOS 26.0, *), derivedConfig.macosBackgroundStyle != .defaultStyle {
|
||||
setupGlassLayer()
|
||||
} else if let appDelegate = NSApp.delegate as? AppDelegate {
|
||||
ghostty_set_window_background_blur(
|
||||
|
|
@ -633,7 +633,7 @@ class TerminalWindow: NSWindow {
|
|||
self.backgroundColor = NSColor.windowBackgroundColor
|
||||
self.backgroundOpacity = 1
|
||||
self.macosWindowButtons = .visible
|
||||
self.macosBackgroundStyle = .blur
|
||||
self.macosBackgroundStyle = .defaultStyle
|
||||
self.windowCornerRadius = 16
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -262,7 +262,7 @@ extension Ghostty {
|
|||
}
|
||||
|
||||
var macosBackgroundStyle: MacBackgroundStyle {
|
||||
let defaultValue = MacBackgroundStyle.blur
|
||||
let defaultValue = MacBackgroundStyle.defaultStyle
|
||||
guard let config = self.config else { return defaultValue }
|
||||
var v: UnsafePointer<Int8>? = nil
|
||||
let key = "macos-background-style"
|
||||
|
|
|
|||
|
|
@ -354,7 +354,7 @@ extension Ghostty {
|
|||
|
||||
/// Enum for the macos-background-style config option
|
||||
enum MacBackgroundStyle: String {
|
||||
case blur
|
||||
case defaultStyle = "default"
|
||||
case regularGlass = "regular-glass"
|
||||
case clearGlass = "clear-glass"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3111,22 +3111,13 @@ keybind: Keybinds = .{},
|
|||
///
|
||||
/// Valid values are:
|
||||
///
|
||||
/// * `blur` - Uses the standard background behavior. The `background-blur`
|
||||
/// * `default` - Uses the standard background behavior. The `background-blur`
|
||||
/// configuration will control whether blur is applied (available on all macOS versions)
|
||||
/// * `regular-glass` - Standard glass effect with some opacity (macOS 26.0+ only)
|
||||
/// * `clear-glass` - Highly transparent glass effect (macOS 26.0+ only)
|
||||
///
|
||||
/// The `blur` option does not force any blur effect - it simply respects the
|
||||
/// `background-blur` configuration. The glass options override `background-blur`
|
||||
/// and apply their own visual effects.
|
||||
///
|
||||
/// On macOS versions prior to 26.0, only `blur` has an effect. The glass
|
||||
/// options will fall back to `blur` behavior on older versions.
|
||||
///
|
||||
/// The default value is `blur`.
|
||||
///
|
||||
/// Available since: 1.2.2
|
||||
@"macos-background-style": MacBackgroundStyle = .blur,
|
||||
@"macos-background-style": MacBackgroundStyle = .default,
|
||||
|
||||
/// Put every surface (tab, split, window) into a dedicated Linux cgroup.
|
||||
///
|
||||
|
|
@ -7714,7 +7705,7 @@ pub const MacShortcuts = enum {
|
|||
|
||||
/// See macos-background-style
|
||||
pub const MacBackgroundStyle = enum {
|
||||
blur,
|
||||
default,
|
||||
@"regular-glass",
|
||||
@"clear-glass",
|
||||
};
|
||||
|
|
|
|||
|
|
@ -561,6 +561,7 @@ pub fn Renderer(comptime GraphicsAPI: type) type {
|
|||
vsync: bool,
|
||||
colorspace: configpkg.Config.WindowColorspace,
|
||||
blending: configpkg.Config.AlphaBlending,
|
||||
macos_background_style: configpkg.Config.MacBackgroundStyle,
|
||||
|
||||
pub fn init(
|
||||
alloc_gpa: Allocator,
|
||||
|
|
@ -633,6 +634,7 @@ pub fn Renderer(comptime GraphicsAPI: type) type {
|
|||
.vsync = config.@"window-vsync",
|
||||
.colorspace = config.@"window-colorspace",
|
||||
.blending = config.@"alpha-blending",
|
||||
.macos_background_style = config.@"macos-background-style",
|
||||
.arena = arena,
|
||||
};
|
||||
}
|
||||
|
|
@ -644,6 +646,16 @@ pub fn Renderer(comptime GraphicsAPI: type) type {
|
|||
}
|
||||
};
|
||||
|
||||
/// Determines if the terminal background should be disabled based on platform and config.
|
||||
/// On macOS, when background effects are enabled (background style != default), the effect
|
||||
/// layer handles the background rendering instead of the terminal renderer.
|
||||
fn shouldDisableBackground(config: DerivedConfig) bool {
|
||||
return switch (builtin.os.tag) {
|
||||
.macos => config.macos_background_style != .default,
|
||||
else => false,
|
||||
};
|
||||
}
|
||||
|
||||
pub fn init(alloc: Allocator, options: renderer.Options) !Self {
|
||||
// Initialize our graphics API wrapper, this will prepare the
|
||||
// surface provided by the apprt and set up any API-specific
|
||||
|
|
@ -716,7 +728,10 @@ pub fn Renderer(comptime GraphicsAPI: type) type {
|
|||
options.config.background.r,
|
||||
options.config.background.g,
|
||||
options.config.background.b,
|
||||
@intFromFloat(@round(options.config.background_opacity * 255.0)),
|
||||
if (shouldDisableBackground(options.config))
|
||||
0
|
||||
else
|
||||
@intFromFloat(@round(options.config.background_opacity * 255.0)),
|
||||
},
|
||||
.bools = .{
|
||||
.cursor_wide = false,
|
||||
|
|
@ -1293,7 +1308,10 @@ pub fn Renderer(comptime GraphicsAPI: type) type {
|
|||
self.terminal_state.colors.background.r,
|
||||
self.terminal_state.colors.background.g,
|
||||
self.terminal_state.colors.background.b,
|
||||
@intFromFloat(@round(self.config.background_opacity * 255.0)),
|
||||
if (shouldDisableBackground(self.config))
|
||||
0
|
||||
else
|
||||
@intFromFloat(@round(self.config.background_opacity * 255.0)),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue