mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-15 16:26:08 +03:00
Merge pull request #923 from vancluever/vancluever-config-gtk-titlebar
apprt/gtk: let GTK titlebar be toggleable
This commit is contained in:
@ -79,20 +79,24 @@ pub fn init(self: *Window, app: *App) !void {
|
|||||||
// Use the new GTK4 header bar. We only create a header bar if we have
|
// Use the new GTK4 header bar. We only create a header bar if we have
|
||||||
// window decorations.
|
// window decorations.
|
||||||
if (app.config.@"window-decoration") {
|
if (app.config.@"window-decoration") {
|
||||||
const header = c.gtk_header_bar_new();
|
// gtk-titlebar can also be used to disable the header bar (but keep
|
||||||
c.gtk_window_set_titlebar(gtk_window, header);
|
// the window manager's decorations).
|
||||||
{
|
if (app.config.@"gtk-titlebar") {
|
||||||
const btn = c.gtk_menu_button_new();
|
const header = c.gtk_header_bar_new();
|
||||||
c.gtk_widget_set_tooltip_text(btn, "Main Menu");
|
c.gtk_window_set_titlebar(gtk_window, header);
|
||||||
c.gtk_menu_button_set_icon_name(@ptrCast(btn), "open-menu-symbolic");
|
{
|
||||||
c.gtk_menu_button_set_menu_model(@ptrCast(btn), @ptrCast(@alignCast(app.menu)));
|
const btn = c.gtk_menu_button_new();
|
||||||
c.gtk_header_bar_pack_end(@ptrCast(header), btn);
|
c.gtk_widget_set_tooltip_text(btn, "Main Menu");
|
||||||
}
|
c.gtk_menu_button_set_icon_name(@ptrCast(btn), "open-menu-symbolic");
|
||||||
{
|
c.gtk_menu_button_set_menu_model(@ptrCast(btn), @ptrCast(@alignCast(app.menu)));
|
||||||
const btn = c.gtk_button_new_from_icon_name("tab-new-symbolic");
|
c.gtk_header_bar_pack_end(@ptrCast(header), btn);
|
||||||
c.gtk_widget_set_tooltip_text(btn, "New Tab");
|
}
|
||||||
c.gtk_header_bar_pack_end(@ptrCast(header), btn);
|
{
|
||||||
_ = c.g_signal_connect_data(btn, "clicked", c.G_CALLBACK(>kTabNewClick), self, null, c.G_CONNECT_DEFAULT);
|
const btn = c.gtk_button_new_from_icon_name("tab-new-symbolic");
|
||||||
|
c.gtk_widget_set_tooltip_text(btn, "New Tab");
|
||||||
|
c.gtk_header_bar_pack_end(@ptrCast(header), btn);
|
||||||
|
_ = c.g_signal_connect_data(btn, "clicked", c.G_CALLBACK(>kTabNewClick), self, null, c.G_CONNECT_DEFAULT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Hide window decoration if configured. This has to happen before
|
// Hide window decoration if configured. This has to happen before
|
||||||
|
@ -472,6 +472,14 @@ keybind: Keybinds = .{},
|
|||||||
/// Currently only supported on macOS.
|
/// Currently only supported on macOS.
|
||||||
@"window-step-resize": bool = false,
|
@"window-step-resize": bool = false,
|
||||||
|
|
||||||
|
/// 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.
|
||||||
|
///
|
||||||
|
/// This option does nothing when window-decoration is false or when running
|
||||||
|
/// under MacOS.
|
||||||
|
@"gtk-titlebar": bool = true,
|
||||||
|
|
||||||
/// Whether to allow programs running in the terminal to read/write to
|
/// Whether to allow programs running in the terminal to read/write to
|
||||||
/// the system clipboard (OSC 52, for googling). The default is to
|
/// the system clipboard (OSC 52, for googling). The default is to
|
||||||
/// allow clipboard reading after prompting the user and allow writing
|
/// allow clipboard reading after prompting the user and allow writing
|
||||||
|
Reference in New Issue
Block a user