feat: add bar_left and bar_right widget styles

This commit is contained in:
CJ van den Berg 2025-11-17 18:02:33 +01:00
parent 6e5e5315f5
commit c6e56abcb0
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
2 changed files with 20 additions and 0 deletions

View file

@ -43,6 +43,8 @@ widget_style: WidgetStyle = .compact,
palette_style: WidgetStyle = .bars_top_bottom, palette_style: WidgetStyle = .bars_top_bottom,
panel_style: WidgetStyle = .compact, panel_style: WidgetStyle = .compact,
home_style: WidgetStyle = .bars_top_bottom, home_style: WidgetStyle = .bars_top_bottom,
pane_left_style: WidgetStyle = .bar_right,
pane_right_style: WidgetStyle = .bar_left,
lsp_output: enum { quiet, verbose } = .quiet, lsp_output: enum { quiet, verbose } = .quiet,
@ -78,11 +80,15 @@ pub const WidgetType = enum {
palette, palette,
panel, panel,
home, home,
pane_left,
pane_right,
}; };
pub const WidgetStyle = enum { pub const WidgetStyle = enum {
bars_top_bottom, bars_top_bottom,
bars_left_right, bars_left_right,
bar_left,
bar_right,
thick_boxed, thick_boxed,
extra_thick_boxed, extra_thick_boxed,
dotted_boxed, dotted_boxed,

View file

@ -29,6 +29,8 @@ pub const Margin = struct {
const @"top/bottom/2": Margin = .{ .top = 2, .bottom = 2, .left = 0, .right = 0 }; const @"top/bottom/2": Margin = .{ .top = 2, .bottom = 2, .left = 0, .right = 0 };
const @"left/right/1": Margin = .{ .top = 0, .bottom = 0, .left = 1, .right = 1 }; const @"left/right/1": Margin = .{ .top = 0, .bottom = 0, .left = 1, .right = 1 };
const @"left/right/2": Margin = .{ .top = 0, .bottom = 0, .left = 2, .right = 2 }; const @"left/right/2": Margin = .{ .top = 0, .bottom = 0, .left = 2, .right = 2 };
const @"left/1": Margin = .{ .top = 0, .bottom = 0, .left = 1, .right = 0 };
const @"right/1": Margin = .{ .top = 0, .bottom = 0, .left = 0, .right = 1 };
}; };
pub const Border = struct { pub const Border = struct {
@ -112,6 +114,16 @@ const bars_left_right: @This() = .{
.border = Border.@"thick box (octant)", .border = Border.@"thick box (octant)",
}; };
const bar_left: @This() = .{
.padding = Margin.@"left/1",
.border = Border.@"thick box (octant)",
};
const bar_right: @This() = .{
.padding = Margin.@"right/1",
.border = Border.@"thick box (octant)",
};
pub fn from_tag(tag: WidgetStyle) *const @This() { pub fn from_tag(tag: WidgetStyle) *const @This() {
return switch (tag) { return switch (tag) {
.compact => &compact, .compact => &compact,
@ -126,6 +138,8 @@ pub fn from_tag(tag: WidgetStyle) *const @This() {
.extra_thick_boxed => &extra_thick_boxed, .extra_thick_boxed => &extra_thick_boxed,
.bars_top_bottom => &bars_top_bottom, .bars_top_bottom => &bars_top_bottom,
.bars_left_right => &bars_left_right, .bars_left_right => &bars_left_right,
.bar_left => &bar_left,
.bar_right => &bar_right,
}; };
} }