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 RepeatableString = Config.RepeatableString;
|
||||
pub const ShellIntegrationFeatures = Config.ShellIntegrationFeatures;
|
||||
pub const WindowPaddingColor = Config.WindowPaddingColor;
|
||||
|
||||
// Alternate APIs
|
||||
pub const CAPI = @import("config/CAPI.zig");
|
||||
|
@ -669,6 +669,16 @@ keybind: Keybinds = .{},
|
||||
/// given a certain viewport size and grid cell size.
|
||||
@"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
|
||||
/// minimize tearing and align redraws with the screen but may cause input
|
||||
/// latency. If false, this will maximize redraw frequency but may cause tearing,
|
||||
@ -2678,6 +2688,11 @@ pub const OptionAsAlt = enum {
|
||||
right,
|
||||
};
|
||||
|
||||
pub const WindowPaddingColor = enum {
|
||||
background,
|
||||
extend,
|
||||
};
|
||||
|
||||
/// Color represents a color using RGB.
|
||||
///
|
||||
/// 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,
|
||||
bold_is_bright: bool,
|
||||
min_contrast: f32,
|
||||
padding_color: configpkg.WindowPaddingColor,
|
||||
custom_shaders: std.ArrayListUnmanaged([:0]const u8),
|
||||
links: link.Set,
|
||||
vsync: bool,
|
||||
@ -402,6 +403,7 @@ pub const DerivedConfig = struct {
|
||||
.invert_selection_fg_bg = config.@"selection-invert-fg-bg",
|
||||
.bold_is_bright = config.@"bold-is-bright",
|
||||
.min_contrast = @floatCast(config.@"minimum-contrast"),
|
||||
.padding_color = config.@"window-padding-color",
|
||||
|
||||
.selection_background = if (config.@"selection-background") |bg|
|
||||
bg.toTerminalRGB()
|
||||
@ -1960,10 +1962,16 @@ pub fn setScreenSize(
|
||||
const padded_dim = dim.subPadding(padding);
|
||||
|
||||
// Blank space around the grid.
|
||||
const blank = dim.blankPadding(padding, grid_size, .{
|
||||
const blank: renderer.Padding = switch (self.config.padding_color) {
|
||||
// We can use zero padding because the backgroudn color is our
|
||||
// clear color.
|
||||
.background => .{},
|
||||
|
||||
.extend => dim.blankPadding(padding, grid_size, .{
|
||||
.width = self.grid_metrics.cell_width,
|
||||
.height = self.grid_metrics.cell_height,
|
||||
}).add(padding);
|
||||
}).add(padding),
|
||||
};
|
||||
|
||||
// Set the size of the drawable surface to the bounds
|
||||
self.layer.setProperty("drawableSize", macos.graphics.Size{
|
||||
|
Reference in New Issue
Block a user