mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
apprt/gtk-ng: toolbar style config
This commit is contained in:
@ -170,7 +170,7 @@ pub const Window = extern struct {
|
||||
Self,
|
||||
bool,
|
||||
.{
|
||||
.nick = "Tab Bar Visiblity",
|
||||
.nick = "Tab Bar Visibility",
|
||||
.blurb = "If true, tab bar should be visible.",
|
||||
.default = true,
|
||||
.accessor = gobject.ext.typedAccessor(Self, bool, .{
|
||||
@ -179,6 +179,27 @@ pub const Window = extern struct {
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
pub const @"toolbar-style" = struct {
|
||||
pub const name = "toolbar-style";
|
||||
const impl = gobject.ext.defineProperty(
|
||||
name,
|
||||
Self,
|
||||
adw.ToolbarStyle,
|
||||
.{
|
||||
.nick = "Toolbar Style",
|
||||
.blurb = "The style for the toolbar top/bottom bars.",
|
||||
.default = .raised,
|
||||
.accessor = gobject.ext.typedAccessor(
|
||||
Self,
|
||||
adw.ToolbarStyle,
|
||||
.{
|
||||
.getter = Self.getToolbarStyle,
|
||||
},
|
||||
),
|
||||
},
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
const Private = struct {
|
||||
@ -284,6 +305,7 @@ pub const Window = extern struct {
|
||||
"tabs-autohide",
|
||||
"tabs-visible",
|
||||
"tabs-wide",
|
||||
"toolbar-style",
|
||||
}) |key| {
|
||||
self.as(gobject.Object).notifyByPspec(
|
||||
@field(properties, key).impl.param_spec,
|
||||
@ -404,6 +426,16 @@ pub const Window = extern struct {
|
||||
return config.@"gtk-wide-tabs";
|
||||
}
|
||||
|
||||
fn getToolbarStyle(self: *Self) adw.ToolbarStyle {
|
||||
const priv = self.private();
|
||||
const config = if (priv.config) |v| v.get() else return .raised;
|
||||
return switch (config.@"gtk-toolbar-style") {
|
||||
.flat => .flat,
|
||||
.raised => .raised,
|
||||
.@"raised-border" => .raised_border,
|
||||
};
|
||||
}
|
||||
|
||||
fn propConfig(
|
||||
_: *adw.ApplicationWindow,
|
||||
_: *gobject.ParamSpec,
|
||||
@ -721,6 +753,7 @@ pub const Window = extern struct {
|
||||
properties.@"tabs-autohide".impl,
|
||||
properties.@"tabs-visible".impl,
|
||||
properties.@"tabs-wide".impl,
|
||||
properties.@"toolbar-style".impl,
|
||||
});
|
||||
|
||||
// Bindings
|
||||
|
@ -24,8 +24,8 @@ template $GhosttyWindow: Adw.ApplicationWindow {
|
||||
view: tab_view;
|
||||
|
||||
Adw.ToolbarView toolbar {
|
||||
top-bar-style: raised;
|
||||
bottom-bar-style: raised;
|
||||
top-bar-style: bind template.toolbar-style;
|
||||
bottom-bar-style: bind template.toolbar-style;
|
||||
|
||||
[top]
|
||||
Adw.HeaderBar {
|
||||
|
Reference in New Issue
Block a user