mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 07:46:12 +03:00
gtk: add config entry to hide titlebar when the window is maximized (#5028)
Fixes #3381 Note that #4936 will need to be merged or you'll need to rely on Gnome's default keybinding for unmaximizing a window (super+down).
This commit is contained in:
@ -204,6 +204,7 @@ pub fn init(self: *Window, app: *App) !void {
|
||||
}
|
||||
|
||||
_ = c.g_signal_connect_data(gtk_window, "notify::decorated", c.G_CALLBACK(>kWindowNotifyDecorated), self, null, c.G_CONNECT_DEFAULT);
|
||||
_ = c.g_signal_connect_data(gtk_window, "notify::maximized", c.G_CALLBACK(>kWindowNotifyMaximized), self, null, c.G_CONNECT_DEFAULT);
|
||||
_ = c.g_signal_connect_data(gtk_window, "notify::fullscreened", c.G_CALLBACK(>kWindowNotifyFullscreened), self, null, c.G_CONNECT_DEFAULT);
|
||||
|
||||
// If we are disabling decorations then disable them right away.
|
||||
@ -601,6 +602,22 @@ fn gtkRealize(v: *c.GtkWindow, ud: ?*anyopaque) callconv(.C) bool {
|
||||
return true;
|
||||
}
|
||||
|
||||
fn gtkWindowNotifyMaximized(
|
||||
_: *c.GObject,
|
||||
_: *c.GParamSpec,
|
||||
ud: ?*anyopaque,
|
||||
) callconv(.C) void {
|
||||
const self = userdataSelf(ud orelse return);
|
||||
const maximized = c.gtk_window_is_maximized(self.window) != 0;
|
||||
if (!maximized) {
|
||||
self.headerbar.setVisible(true);
|
||||
return;
|
||||
}
|
||||
if (self.app.config.@"gtk-titlebar-hide-when-maximized") {
|
||||
self.headerbar.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
fn gtkWindowNotifyDecorated(
|
||||
object: *c.GObject,
|
||||
_: *c.GParamSpec,
|
||||
|
@ -2032,6 +2032,10 @@ keybind: Keybinds = .{},
|
||||
/// title bar, or you can switch tabs with keybinds.
|
||||
@"gtk-tabs-location": GtkTabsLocation = .top,
|
||||
|
||||
/// If this is `true`, the titlebar will be hidden when the window is maximized,
|
||||
/// and shown when the titlebar is unmaximized. GTK only.
|
||||
@"gtk-titlebar-hide-when-maximized": bool = false,
|
||||
|
||||
/// Determines the appearance of the top and bottom bars when using the
|
||||
/// Adwaita tab bar. This requires `gtk-adwaita` to be enabled (it is
|
||||
/// by default).
|
||||
|
Reference in New Issue
Block a user