feat(config): allow fullscreen config to specify non-native mode directly

Co-Authored-By: Sachin <sachinbeniwal0101@gmail.com>
This commit is contained in:
benodiwal
2025-12-12 04:00:09 +05:30
committed by Mitchell Hashimoto
parent cc17e96895
commit 3d0da44e15
7 changed files with 99 additions and 29 deletions

View File

@@ -312,6 +312,7 @@ const DerivedConfig = struct {
mouse_reporting: bool,
mouse_scroll_multiplier: configpkg.MouseScrollMultiplier,
mouse_shift_capture: configpkg.MouseShiftCapture,
fullscreen: configpkg.Fullscreen,
macos_non_native_fullscreen: configpkg.NonNativeFullscreen,
macos_option_as_alt: ?input.OptionAsAlt,
selection_clear_on_copy: bool,
@@ -389,6 +390,7 @@ const DerivedConfig = struct {
.mouse_reporting = config.@"mouse-reporting",
.mouse_scroll_multiplier = config.@"mouse-scroll-multiplier",
.mouse_shift_capture = config.@"mouse-shift-capture",
.fullscreen = config.fullscreen,
.macos_non_native_fullscreen = config.@"macos-non-native-fullscreen",
.macos_option_as_alt = config.@"macos-option-as-alt",
.selection_clear_on_copy = config.@"selection-clear-on-copy",

View File

@@ -308,7 +308,7 @@ pub const Window = extern struct {
if (priv.config) |config_obj| {
const config = config_obj.get();
if (config.maximize) self.as(gtk.Window).maximize();
if (config.fullscreen) self.as(gtk.Window).fullscreen();
if (config.fullscreen != .false) self.as(gtk.Window).fullscreen();
// If we have an explicit title set, we set that immediately
// so that any applications inspecting the window states see

View File

@@ -31,6 +31,7 @@ pub const Keybinds = Config.Keybinds;
pub const MouseShiftCapture = Config.MouseShiftCapture;
pub const MouseScrollMultiplier = Config.MouseScrollMultiplier;
pub const NonNativeFullscreen = Config.NonNativeFullscreen;
pub const Fullscreen = Config.Fullscreen;
pub const RepeatableCodepointMap = Config.RepeatableCodepointMap;
pub const RepeatableFontVariation = Config.RepeatableFontVariation;
pub const RepeatableString = Config.RepeatableString;

View File

@@ -1428,10 +1428,27 @@ maximize: bool = false,
/// does not apply to tabs, splits, etc. However, this setting will apply to all
/// new windows, not just the first one.
///
/// On macOS, this setting does not work if window-decoration is set to
/// "none", because native fullscreen on macOS requires window decorations
/// to be set.
fullscreen: bool = false,
/// Allowable values are:
///
/// * `false` - Don't start in fullscreen (default)
/// * `true` - Start in native fullscreen
/// * `non-native` - (macOS only) Start in non-native fullscreen, hiding the
/// menu bar. This is faster than native fullscreen since it doesn't use
/// animations. On non-macOS platforms, this behaves the same as `true`.
/// * `non-native-visible-menu` - (macOS only) Start in non-native fullscreen,
/// keeping the menu bar visible. On non-macOS platforms, behaves like `true`.
/// * `non-native-padded-notch` - (macOS only) Start in non-native fullscreen,
/// hiding the menu bar but padding for the notch on applicable devices.
/// On non-macOS platforms, behaves like `true`.
///
/// Important: tabs DO NOT WORK with non-native fullscreen modes. Non-native
/// fullscreen removes the titlebar and macOS native tabs require the titlebar.
/// If you use tabs, use `true` (native) instead.
///
/// On macOS, `true` (native fullscreen) does not work if `window-decoration`
/// is set to `false`, because native fullscreen on macOS requires window
/// decorations.
fullscreen: Fullscreen = .false,
/// The title Ghostty will use for the window. This will force the title of the
/// window to be this title at all times and Ghostty will ignore any set title
@@ -5136,6 +5153,17 @@ pub const NonNativeFullscreen = enum(c_int) {
@"padded-notch",
};
/// Valid values for fullscreen config option
/// c_int because it needs to be extern compatible
/// If this is changed, you must also update ghostty.h
pub const Fullscreen = enum(c_int) {
false,
true,
@"non-native",
@"non-native-visible-menu",
@"non-native-padded-notch",
};
pub const WindowPaddingColor = enum {
background,
extend,