mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 08:46:08 +03:00
Merge pull request #1292 from mitchellh/mrn/gtk-append-new-tabs
gtk: append new tabs at the end if config is set
This commit is contained in:
@ -107,13 +107,17 @@ pub fn init(self: *Tab, window: *Window, parent_: ?*CoreSurface) !void {
|
||||
const gl_area_widget = @as(*c.GtkWidget, @ptrCast(surface.gl_area));
|
||||
c.gtk_box_append(self.box, gl_area_widget);
|
||||
|
||||
// Add the notebook page (create tab). We create the tab after our
|
||||
// current selected tab if we have one.
|
||||
// Add the notebook page (create tab).
|
||||
const parent_page_idx = switch (window.app.config.@"window-new-tab-position") {
|
||||
.current => c.gtk_notebook_get_current_page(window.notebook) + 1,
|
||||
.end => c.gtk_notebook_get_n_pages(window.notebook),
|
||||
};
|
||||
|
||||
const page_idx = c.gtk_notebook_insert_page(
|
||||
window.notebook,
|
||||
box_widget,
|
||||
label_box_widget,
|
||||
c.gtk_notebook_get_current_page(window.notebook) + 1,
|
||||
parent_page_idx,
|
||||
);
|
||||
if (page_idx < 0) {
|
||||
log.warn("failed to add page to notebook", .{});
|
||||
|
@ -656,6 +656,15 @@ keybind: Keybinds = .{},
|
||||
/// Currently only supported on macOS.
|
||||
@"window-step-resize": bool = false,
|
||||
|
||||
/// The position where new tabs are created. Valid values:
|
||||
///
|
||||
/// - "current" - Insert the new tab after the currently focused tab,
|
||||
/// or at the end if there are no focused tabs.
|
||||
/// - "end" - Insert the new tab at the end of the tab list.
|
||||
///
|
||||
/// This configuration currently only works with GTK.
|
||||
@"window-new-tab-position": WindowNewTabPosition = .current,
|
||||
|
||||
/// When enabled, the full GTK titlebar is displayed instead of your window
|
||||
/// manager's simple titlebar. The behavior of this option will vary with your
|
||||
/// window manager.
|
||||
@ -2895,6 +2904,12 @@ pub const WindowSaveState = enum {
|
||||
always,
|
||||
};
|
||||
|
||||
/// See window-new-tab-position
|
||||
pub const WindowNewTabPosition = enum {
|
||||
current,
|
||||
end,
|
||||
};
|
||||
|
||||
/// See grapheme-width-method
|
||||
pub const GraphemeWidthMethod = enum {
|
||||
wcswidth,
|
||||
|
Reference in New Issue
Block a user