remove the macos-background-style config

This commit is contained in:
Mitchell Hashimoto
2025-12-15 10:48:20 -08:00
parent bb23071166
commit a6ddf03a2e
6 changed files with 42 additions and 68 deletions

View File

@@ -927,6 +927,12 @@ palette: Palette = .{},
/// reasonable for a good looking blur. Higher blur intensities may
/// cause strange rendering and performance issues.
///
/// On macOS 26.0 and later, there are additional special values that
/// can be set to use the native macOS glass effects:
///
/// * `macos-glass-regular` - Standard glass effect with some opacity
/// * `macos-glass-clear` - Highly transparent glass effect
///
/// Supported on macOS and on some Linux desktop environments, including:
///
/// * KDE Plasma (Wayland and X11)
@@ -3106,22 +3112,6 @@ keybind: Keybinds = .{},
/// Available since: 1.2.0
@"macos-shortcuts": MacShortcuts = .ask,
/// The background style for macOS windows when `background-opacity` is less
/// than 1. This controls the visual effect applied behind the terminal
/// background.
///
/// Valid values are:
///
/// * `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)
///
/// Available since: 1.3.0
@"macos-background-style": MacBackgroundStyle = .default,
/// Put every surface (tab, split, window) into a dedicated Linux cgroup.
///
/// This makes it so that resource management can be done on a per-surface
@@ -7706,13 +7696,6 @@ pub const MacShortcuts = enum {
ask,
};
/// See macos-background-style
pub const MacBackgroundStyle = enum {
default,
@"regular-glass",
@"clear-glass",
};
/// See gtk-single-instance
pub const GtkSingleInstance = enum {
false,

View File

@@ -561,7 +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,
background_blur: configpkg.Config.BackgroundBlur,
pub fn init(
alloc_gpa: Allocator,
@@ -634,7 +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",
.background_blur = config.@"background-blur",
.arena = arena,
};
}
@@ -646,16 +646,6 @@ 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
@@ -728,6 +718,9 @@ pub fn Renderer(comptime GraphicsAPI: type) type {
options.config.background.r,
options.config.background.g,
options.config.background.b,
// Note that if we're on macOS with glass effects
// we'll disable background opacity but we handle
// that in updateFrame.
@intFromFloat(@round(options.config.background_opacity * 255.0)),
},
.bools = .{
@@ -1305,10 +1298,18 @@ 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,
if (shouldDisableBackground(self.config))
0
else
@intFromFloat(@round(self.config.background_opacity * 255.0)),
@intFromFloat(@round(self.config.background_opacity * 255.0)),
};
// If we're on macOS and have glass styles, we remove
// the background opacity because the glass effect handles
// it.
if (comptime builtin.os.tag == .macos) switch (self.config.background_blur) {
.@"macos-glass-regular",
.@"macos-glass-clear",
=> self.uniforms.bg_color[3] = 0,
else => {},
};
}
}