apprt/gtk: make wide-style gtk tabs configurable

This commit is contained in:
Mitchell Hashimoto
2023-09-28 08:54:15 -07:00
parent 16f5af8b32
commit 685495c896
2 changed files with 14 additions and 4 deletions

View File

@ -203,13 +203,17 @@ pub fn newTab(self: *Window, parent_: ?*CoreSurface) !void {
// Build our tab label // Build our tab label
const label_box_widget = c.gtk_box_new(c.GTK_ORIENTATION_HORIZONTAL, 0); const label_box_widget = c.gtk_box_new(c.GTK_ORIENTATION_HORIZONTAL, 0);
c.gtk_widget_set_hexpand(label_box_widget, 1);
c.gtk_widget_set_halign(label_box_widget, c.GTK_ALIGN_FILL);
const label_box = @as(*c.GtkBox, @ptrCast(label_box_widget)); const label_box = @as(*c.GtkBox, @ptrCast(label_box_widget));
const label_text = c.gtk_label_new("Ghostty"); const label_text = c.gtk_label_new("Ghostty");
c.gtk_box_append(label_box, label_text);
// Wide style GTK tabs
if (self.app.config.@"gtk-wide-tabs") {
c.gtk_widget_set_hexpand(label_box_widget, 1);
c.gtk_widget_set_halign(label_box_widget, c.GTK_ALIGN_FILL);
c.gtk_widget_set_hexpand(label_text, 1); c.gtk_widget_set_hexpand(label_text, 1);
c.gtk_widget_set_halign(label_text, c.GTK_ALIGN_FILL); c.gtk_widget_set_halign(label_text, c.GTK_ALIGN_FILL);
c.gtk_box_append(label_box, label_text); }
const label_close_widget = c.gtk_button_new_from_icon_name("window-close"); const label_close_widget = c.gtk_button_new_from_icon_name("window-close");
const label_close = @as(*c.GtkButton, @ptrCast(label_close_widget)); const label_close = @as(*c.GtkButton, @ptrCast(label_close_widget));

View File

@ -411,6 +411,12 @@ keybind: Keybinds = .{},
/// Debug builds of Ghostty have a separate single-instance ID. /// Debug builds of Ghostty have a separate single-instance ID.
@"gtk-single-instance": bool = true, @"gtk-single-instance": bool = true,
/// If true (default), then the Ghostty GTK tabs will be "wide." Wide tabs
/// are the new typical Gnome style where tabs fill their available space.
/// If you set this to false then tabs will only take up space they need,
/// which is the old style.
@"gtk-wide-tabs": bool = true,
/// This will be used to set the TERM environment variable. /// This will be used to set the TERM environment variable.
/// HACK: We set this with an "xterm" prefix because vim uses that to enable key /// HACK: We set this with an "xterm" prefix because vim uses that to enable key
/// protocols (specifically this will enable 'modifyOtherKeys'), among other /// protocols (specifically this will enable 'modifyOtherKeys'), among other