diff --git a/macos/Sources/Features/Primary Window/PrimaryView.swift b/macos/Sources/Features/Primary Window/PrimaryView.swift index 6269adfcf..9744ed234 100644 --- a/macos/Sources/Features/Primary Window/PrimaryView.swift +++ b/macos/Sources/Features/Primary Window/PrimaryView.swift @@ -82,6 +82,7 @@ struct PrimaryView: View { self.window.title = newValue } .onChange(of: cellSize) { newValue in + if !ghostty.windowStepResize { return } guard let size = newValue else { return } self.window.contentResizeIncrements = size } diff --git a/macos/Sources/Ghostty/AppState.swift b/macos/Sources/Ghostty/AppState.swift index 8ab25a2c0..4f637e3a9 100644 --- a/macos/Sources/Ghostty/AppState.swift +++ b/macos/Sources/Ghostty/AppState.swift @@ -97,6 +97,15 @@ extension Ghostty { return String(cString: ptr) } + /// Whether to resize windows in discrete steps or use "fluid" resizing + var windowStepResize: Bool { + guard let config = self.config else { return true } + var v = false + let key = "window-step-resize" + _ = ghostty_config_get(config, &v, key, UInt(key.count)) + return v + } + /// The background opacity. var backgroundOpacity: Double { guard let config = self.config else { return 1 } diff --git a/src/config/Config.zig b/src/config/Config.zig index 0f42ba743..754884ffc 100644 --- a/src/config/Config.zig +++ b/src/config/Config.zig @@ -390,6 +390,10 @@ keybind: Keybinds = .{}, @"window-height": u32 = 0, @"window-width": u32 = 0, +/// Whether to resize the window in discrete increments of the focused surface's +/// cell size. Currently only supported on macOS. +@"window-step-resize": bool = false, + /// Whether to allow programs running in the terminal to read/write to /// the system clipboard (OSC 52, for googling). The default is to /// disallow clipboard reading but allow writing.