From fa81445701d88cf76fac0040bd604132722842d7 Mon Sep 17 00:00:00 2001 From: Paul Date: Wed, 11 Sep 2024 20:03:07 +0200 Subject: [PATCH 1/3] adw: add option to choose toolbar style --- src/apprt/gtk/Window.zig | 8 ++++++++ src/config/Config.zig | 13 +++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/apprt/gtk/Window.zig b/src/apprt/gtk/Window.zig index 68b1197f7..28906565f 100644 --- a/src/apprt/gtk/Window.zig +++ b/src/apprt/gtk/Window.zig @@ -183,6 +183,14 @@ pub fn init(self: *Window, app: *App) !void { } c.adw_toolbar_view_set_content(toolbar_view, box); + const toolbar_style: c.AdwToolbarStyle = switch (self.app.config.@"adw-toolbar-style") { + .flat => c.ADW_TOOLBAR_FLAT, + .raised => c.ADW_TOOLBAR_RAISED, + .@"raised-border" => c.ADW_TOOLBAR_RAISED_BORDER, + }; + c.adw_toolbar_view_set_top_bar_style(toolbar_view, toolbar_style); + c.adw_toolbar_view_set_bottom_bar_style(toolbar_view, toolbar_style); + c.adw_application_window_set_content(@ptrCast(gtk_window), @ptrCast(@alignCast(toolbar_view))); } else { // The box is our main child diff --git a/src/config/Config.zig b/src/config/Config.zig index 2ae3aad0b..eb3b98598 100644 --- a/src/config/Config.zig +++ b/src/config/Config.zig @@ -1426,6 +1426,12 @@ keybind: Keybinds = .{}, /// back to `top`. @"gtk-tabs-location": GtkTabsLocation = .top, +/// Determines the appearance of the top and bottom bars when using the adwaita tab bar. +/// If set to `flat`, top and bottom bars are flat with the terminal window. +/// If set to `raised`, top and bottom bars cast a shadow on the terminal area. +/// `raised-border` is similar to `raised` but the shadow is replaced with a more subtle border. +@"adw-toolbar-style": AdwToolBarStyle = .raised, + /// 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, @@ -4064,6 +4070,13 @@ pub const GtkTabsLocation = enum { right, }; +/// See adw-toolbar-style +pub const AdwToolBarStyle = enum { + flat, + raised, + @"raised-border", +}; + /// See mouse-shift-capture pub const MouseShiftCapture = enum { false, From f0ca0e551e1a2f07afd08fdca8a635f248fa94c4 Mon Sep 17 00:00:00 2001 From: Paul Date: Wed, 11 Sep 2024 20:24:58 +0200 Subject: [PATCH 2/3] adw: show performance warning banner --- src/apprt/gtk/Window.zig | 1 + 1 file changed, 1 insertion(+) diff --git a/src/apprt/gtk/Window.zig b/src/apprt/gtk/Window.zig index 28906565f..2ae5079d7 100644 --- a/src/apprt/gtk/Window.zig +++ b/src/apprt/gtk/Window.zig @@ -132,6 +132,7 @@ pub fn init(self: *Window, app: *App) !void { adwaita.versionAtLeast(1, 3, 0)) { const banner = c.adw_banner_new(warning_text); + c.adw_banner_set_revealed(@ptrCast(banner), 1); c.gtk_box_append(@ptrCast(box), @ptrCast(banner)); } else { const warning = c.gtk_label_new(warning_text); From ff2ec11f8cb75d353abb6f98f14bf4511c114fda Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 11 Sep 2024 12:06:31 -0700 Subject: [PATCH 3/3] config: update docs, caps --- src/config/Config.zig | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/config/Config.zig b/src/config/Config.zig index eb3b98598..141ae3b20 100644 --- a/src/config/Config.zig +++ b/src/config/Config.zig @@ -1426,11 +1426,19 @@ keybind: Keybinds = .{}, /// back to `top`. @"gtk-tabs-location": GtkTabsLocation = .top, -/// Determines the appearance of the top and bottom bars when using the adwaita tab bar. -/// If set to `flat`, top and bottom bars are flat with the terminal window. -/// If set to `raised`, top and bottom bars cast a shadow on the terminal area. -/// `raised-border` is similar to `raised` but the shadow is replaced with a more subtle border. -@"adw-toolbar-style": AdwToolBarStyle = .raised, +/// 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). +/// +/// Valid values are: +/// +/// * `flat` - Top and bottom bars are flat with the terminal window. +/// * `raised` - Top and bottom bars cast a shadow on the terminal area. +/// * `raised-border` - Similar to `raised` but the shadow is replaced with a +/// more subtle border. +/// +/// Changing this value at runtime will only affect new windows. +@"adw-toolbar-style": AdwToolbarStyle = .raised, /// 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. @@ -4071,7 +4079,7 @@ pub const GtkTabsLocation = enum { }; /// See adw-toolbar-style -pub const AdwToolBarStyle = enum { +pub const AdwToolbarStyle = enum { flat, raised, @"raised-border",