From a79713f57de954ce86ec517b270cefdcfed7d866 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rio=20Victor=20Ribeiro=20Silva?= Date: Thu, 2 Jan 2025 10:17:35 -0300 Subject: [PATCH] refactor: change variable name and evaluation --- src/apprt/gtk/Window.zig | 10 ++++++---- src/config/Config.zig | 9 +++++++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/apprt/gtk/Window.zig b/src/apprt/gtk/Window.zig index b88c5ce91..c7fbad3f5 100644 --- a/src/apprt/gtk/Window.zig +++ b/src/apprt/gtk/Window.zig @@ -265,10 +265,12 @@ pub fn init(self: *Window, app: *App) !void { c.gtk_popover_set_has_arrow(@ptrCast(@alignCast(self.context_menu)), 0); c.gtk_widget_set_halign(self.context_menu, c.GTK_ALIGN_START); - if (app.config.@"gtk-maximize") c.gtk_window_maximize(self.window); - - // If we are in fullscreen mode, new windows start fullscreen. - if (app.config.fullscreen) c.gtk_window_fullscreen(self.window); + // Set window mode based on the config + if (app.config.fullscreen) { + c.gtk_window_fullscreen(self.window); + } else if (app.config.maximize) { + c.gtk_window_maximize(self.window); + } // We register a key event controller with the window so // we can catch key events when our surface may not be diff --git a/src/config/Config.zig b/src/config/Config.zig index cc3ee0b38..6463f141f 100644 --- a/src/config/Config.zig +++ b/src/config/Config.zig @@ -1855,8 +1855,9 @@ keybind: Keybinds = .{}, /// does not apply to tabs, splits, etc. However, this setting will apply to all /// new windows, not just the first one. /// -/// This setting is overwritten by `fullscreen` option. -@"gtk-maximize": bool = false, +/// This setting will be ignored if `fullscreen = true`. +/// Note: This only works on Linux. +maximize: bool = false, /// If `true`, the Ghostty GTK application will run in single-instance mode: /// each new `ghostty` process launched will result in a new window if there is @@ -3284,6 +3285,10 @@ pub fn finalize(self: *Config) !void { } } + if (self.maximize and self.fullscreen) { + log.warn("'fullscreen' and 'maximize' cannot be used at the same time, 'maximize' will be ignored.", .{}); + } + // We can't set this as a struct default because our config is // loaded in environments where a build config isn't available. if (self.@"auto-update-channel" == null) {