mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 08:46:08 +03:00
Merge pull request #2219 from Pangoraw/toolbar-style
adw: add option to choose toolbar style
This commit is contained in:
@ -132,6 +132,7 @@ pub fn init(self: *Window, app: *App) !void {
|
|||||||
adwaita.versionAtLeast(1, 3, 0))
|
adwaita.versionAtLeast(1, 3, 0))
|
||||||
{
|
{
|
||||||
const banner = c.adw_banner_new(warning_text);
|
const banner = c.adw_banner_new(warning_text);
|
||||||
|
c.adw_banner_set_revealed(@ptrCast(banner), 1);
|
||||||
c.gtk_box_append(@ptrCast(box), @ptrCast(banner));
|
c.gtk_box_append(@ptrCast(box), @ptrCast(banner));
|
||||||
} else {
|
} else {
|
||||||
const warning = c.gtk_label_new(warning_text);
|
const warning = c.gtk_label_new(warning_text);
|
||||||
@ -183,6 +184,14 @@ pub fn init(self: *Window, app: *App) !void {
|
|||||||
}
|
}
|
||||||
c.adw_toolbar_view_set_content(toolbar_view, box);
|
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)));
|
c.adw_application_window_set_content(@ptrCast(gtk_window), @ptrCast(@alignCast(toolbar_view)));
|
||||||
} else {
|
} else {
|
||||||
// The box is our main child
|
// The box is our main child
|
||||||
|
@ -1426,6 +1426,20 @@ keybind: Keybinds = .{},
|
|||||||
/// back to `top`.
|
/// back to `top`.
|
||||||
@"gtk-tabs-location": GtkTabsLocation = .top,
|
@"gtk-tabs-location": GtkTabsLocation = .top,
|
||||||
|
|
||||||
|
/// 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
|
/// 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.
|
/// 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,
|
/// If you set this to `false` then tabs will only take up space they need,
|
||||||
@ -4064,6 +4078,13 @@ pub const GtkTabsLocation = enum {
|
|||||||
right,
|
right,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// See adw-toolbar-style
|
||||||
|
pub const AdwToolbarStyle = enum {
|
||||||
|
flat,
|
||||||
|
raised,
|
||||||
|
@"raised-border",
|
||||||
|
};
|
||||||
|
|
||||||
/// See mouse-shift-capture
|
/// See mouse-shift-capture
|
||||||
pub const MouseShiftCapture = enum {
|
pub const MouseShiftCapture = enum {
|
||||||
false,
|
false,
|
||||||
|
Reference in New Issue
Block a user