mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 15:56:13 +03:00
config: add window-padding-color
This commit is contained in:
@ -20,6 +20,7 @@ pub const RepeatableCodepointMap = Config.RepeatableCodepointMap;
|
|||||||
pub const RepeatableFontVariation = Config.RepeatableFontVariation;
|
pub const RepeatableFontVariation = Config.RepeatableFontVariation;
|
||||||
pub const RepeatableString = Config.RepeatableString;
|
pub const RepeatableString = Config.RepeatableString;
|
||||||
pub const ShellIntegrationFeatures = Config.ShellIntegrationFeatures;
|
pub const ShellIntegrationFeatures = Config.ShellIntegrationFeatures;
|
||||||
|
pub const WindowPaddingColor = Config.WindowPaddingColor;
|
||||||
|
|
||||||
// Alternate APIs
|
// Alternate APIs
|
||||||
pub const CAPI = @import("config/CAPI.zig");
|
pub const CAPI = @import("config/CAPI.zig");
|
||||||
|
@ -669,6 +669,16 @@ keybind: Keybinds = .{},
|
|||||||
/// given a certain viewport size and grid cell size.
|
/// given a certain viewport size and grid cell size.
|
||||||
@"window-padding-balance": bool = false,
|
@"window-padding-balance": bool = false,
|
||||||
|
|
||||||
|
/// The color of the padding area of the window. Valid values are:
|
||||||
|
///
|
||||||
|
/// * `background` - The background color specified in `background`.
|
||||||
|
/// * `extend` - Extend the background color of the nearest grid cell.
|
||||||
|
///
|
||||||
|
/// The default value is "extend". This allows for smooth resizing of a
|
||||||
|
/// terminal grid without having visible empty areas around the edge. The edge
|
||||||
|
/// cells may appear slightly larger due to the extension.
|
||||||
|
@"window-padding-color": WindowPaddingColor = .extend,
|
||||||
|
|
||||||
/// Synchronize rendering with the screen refresh rate. If true, this will
|
/// Synchronize rendering with the screen refresh rate. If true, this will
|
||||||
/// minimize tearing and align redraws with the screen but may cause input
|
/// minimize tearing and align redraws with the screen but may cause input
|
||||||
/// latency. If false, this will maximize redraw frequency but may cause tearing,
|
/// latency. If false, this will maximize redraw frequency but may cause tearing,
|
||||||
@ -2678,6 +2688,11 @@ pub const OptionAsAlt = enum {
|
|||||||
right,
|
right,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
pub const WindowPaddingColor = enum {
|
||||||
|
background,
|
||||||
|
extend,
|
||||||
|
};
|
||||||
|
|
||||||
/// Color represents a color using RGB.
|
/// Color represents a color using RGB.
|
||||||
///
|
///
|
||||||
/// This is a packed struct so that the C API to read color values just
|
/// This is a packed struct so that the C API to read color values just
|
||||||
|
@ -345,6 +345,7 @@ pub const DerivedConfig = struct {
|
|||||||
invert_selection_fg_bg: bool,
|
invert_selection_fg_bg: bool,
|
||||||
bold_is_bright: bool,
|
bold_is_bright: bool,
|
||||||
min_contrast: f32,
|
min_contrast: f32,
|
||||||
|
padding_color: configpkg.WindowPaddingColor,
|
||||||
custom_shaders: std.ArrayListUnmanaged([:0]const u8),
|
custom_shaders: std.ArrayListUnmanaged([:0]const u8),
|
||||||
links: link.Set,
|
links: link.Set,
|
||||||
vsync: bool,
|
vsync: bool,
|
||||||
@ -402,6 +403,7 @@ pub const DerivedConfig = struct {
|
|||||||
.invert_selection_fg_bg = config.@"selection-invert-fg-bg",
|
.invert_selection_fg_bg = config.@"selection-invert-fg-bg",
|
||||||
.bold_is_bright = config.@"bold-is-bright",
|
.bold_is_bright = config.@"bold-is-bright",
|
||||||
.min_contrast = @floatCast(config.@"minimum-contrast"),
|
.min_contrast = @floatCast(config.@"minimum-contrast"),
|
||||||
|
.padding_color = config.@"window-padding-color",
|
||||||
|
|
||||||
.selection_background = if (config.@"selection-background") |bg|
|
.selection_background = if (config.@"selection-background") |bg|
|
||||||
bg.toTerminalRGB()
|
bg.toTerminalRGB()
|
||||||
@ -1960,10 +1962,16 @@ pub fn setScreenSize(
|
|||||||
const padded_dim = dim.subPadding(padding);
|
const padded_dim = dim.subPadding(padding);
|
||||||
|
|
||||||
// Blank space around the grid.
|
// Blank space around the grid.
|
||||||
const blank = dim.blankPadding(padding, grid_size, .{
|
const blank: renderer.Padding = switch (self.config.padding_color) {
|
||||||
.width = self.grid_metrics.cell_width,
|
// We can use zero padding because the backgroudn color is our
|
||||||
.height = self.grid_metrics.cell_height,
|
// clear color.
|
||||||
}).add(padding);
|
.background => .{},
|
||||||
|
|
||||||
|
.extend => dim.blankPadding(padding, grid_size, .{
|
||||||
|
.width = self.grid_metrics.cell_width,
|
||||||
|
.height = self.grid_metrics.cell_height,
|
||||||
|
}).add(padding),
|
||||||
|
};
|
||||||
|
|
||||||
// Set the size of the drawable surface to the bounds
|
// Set the size of the drawable surface to the bounds
|
||||||
self.layer.setProperty("drawableSize", macos.graphics.Size{
|
self.layer.setProperty("drawableSize", macos.graphics.Size{
|
||||||
|
Reference in New Issue
Block a user