Skip to content

Commit

Permalink
chore: rename config value to maximize and move startup logic to prop…
Browse files Browse the repository at this point in the history
…er location
  • Loading branch information
aw1875 authored and Aaron-212 committed Jan 14, 2025
1 parent 3d3eef0 commit ae6a088
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 17 deletions.
10 changes: 0 additions & 10 deletions src/Surface.zig
Original file line number Diff line number Diff line change
Expand Up @@ -646,16 +646,6 @@ pub fn init(
// an initial size shouldn't stop our terminal from working.
log.warn("unable to set initial window size: {s}", .{err});
};

if (config.@"window-maximize") {
rt_app.performAction(
.{ .surface = self },
.toggle_maximize,
{},
) catch |err| {
log.warn("unable to maximize window: {s}", .{err});
};
}
}

if (config.title) |title| {
Expand Down
3 changes: 3 additions & 0 deletions src/apprt/gtk/Window.zig
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,9 @@ 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 we want the window to be maximized, we do that here.
if (app.config.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);

Expand Down
12 changes: 5 additions & 7 deletions src/config/Config.zig
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,11 @@ link: RepeatableLink = .{},
/// `link`). If you want to customize URL matching, use `link` and disable this.
@"link-url": bool = true,

/// Whether to start the window in a maximized state. This setting applies
/// to new windows and does not apply to tabs, splits, etc. However, this setting
/// will apply to all new windows, not just the first one.
maximize: bool = false,

/// Start new windows in fullscreen. This setting applies to new windows and
/// does not apply to tabs, splits, etc. However, this setting will apply to all
/// new windows, not just the first one.
Expand Down Expand Up @@ -1214,13 +1219,6 @@ keybind: Keybinds = .{},
@"window-position-x": ?i16 = null,
@"window-position-y": ?i16 = null,

/// Whether to start the window in a maximized state. This is only related to
/// the X11 window manager's concept of maximization. In other words, this
/// will set the _NET_WM_STATE property to _NET_WM_STATE_MAXIMIZED_VERT and
/// _NET_WM_STATE_MAXIMIZED_HORZ on launch. This will not affect the window
/// size or position. This is only supported on Linux.
@"window-maximize": bool = false,

/// Whether to enable saving and restoring window state. Window state includes
/// their position, size, tabs, splits, etc. Some window state requires shell
/// integration, such as preserving working directories. See `shell-integration`
Expand Down

0 comments on commit ae6a088

Please sign in to comment.