refactor: change variable name and evaluation

This commit is contained in:
Mário Victor Ribeiro Silva
2025-01-02 10:17:35 -03:00
parent 2542752b06
commit a79713f57d
2 changed files with 13 additions and 6 deletions

View File

@ -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_popover_set_has_arrow(@ptrCast(@alignCast(self.context_menu)), 0);
c.gtk_widget_set_halign(self.context_menu, c.GTK_ALIGN_START); c.gtk_widget_set_halign(self.context_menu, c.GTK_ALIGN_START);
if (app.config.@"gtk-maximize") c.gtk_window_maximize(self.window); // Set window mode based on the config
if (app.config.fullscreen) {
// If we are in fullscreen mode, new windows start fullscreen. c.gtk_window_fullscreen(self.window);
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 register a key event controller with the window so
// we can catch key events when our surface may not be // we can catch key events when our surface may not be

View File

@ -1855,8 +1855,9 @@ keybind: Keybinds = .{},
/// does not apply to tabs, splits, etc. However, this setting will apply to all /// does not apply to tabs, splits, etc. However, this setting will apply to all
/// new windows, not just the first one. /// new windows, not just the first one.
/// ///
/// This setting is overwritten by `fullscreen` option. /// This setting will be ignored if `fullscreen = true`.
@"gtk-maximize": bool = false, /// Note: This only works on Linux.
maximize: bool = false,
/// If `true`, the Ghostty GTK application will run in single-instance mode: /// 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 /// 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 // We can't set this as a struct default because our config is
// loaded in environments where a build config isn't available. // loaded in environments where a build config isn't available.
if (self.@"auto-update-channel" == null) { if (self.@"auto-update-channel" == null) {