configure custom bind width

This commit is contained in:
RadsammyT 2026-03-26 17:08:36 -04:00
commit 44f34b53a6
No known key found for this signature in database
3 changed files with 16 additions and 8 deletions

View file

@ -143,6 +143,10 @@ colormix_col2 = 0x000000FF
# Color mixing animation third color id
colormix_col3 = 0x20000000
# For custom binds: the horizontal limit in characters for each
# line of custom binds before moving on to the next.
custom_bind_width = 0
# Custom sessions directory
# You can specify multiple directories,
# e.g. $CONFIG_DIRECTORY/ly/custom-sessions:$PREFIX_DIRECTORY/share/custom-sessions

View file

@ -37,6 +37,7 @@ cmatrix_max_codepoint: u16 = 0x7B,
colormix_col1: u32 = 0x00FF0000,
colormix_col2: u32 = 0x000000FF,
colormix_col3: u32 = 0x20000000,
custom_bind_width: u32 = 0,
custom_sessions: []const u8 = build_options.config_directory ++ "/ly/custom-sessions",
default_input: Input = .login,
doom_fire_height: u8 = 6,

View file

@ -1892,14 +1892,17 @@ fn positionWidgets(ptr: *anyopaque) !void {
state.brightness_up_label.positionXY(last_label
.childrenPosition()
.addX(1));
for (state.custom_binds.items, 0..) |*item, i| {
if (i == 0)
item.lbl.positionXY(state.edge_margin
.addY(1))
else
item.lbl.positionXY(state.custom_binds.items[i-1].lbl.childrenPosition()
.addX(1)
.removeY(1));
var x_offset: usize = 0;
var y_offset: usize = 1;
for (state.custom_binds.items) |*item| {
item.lbl.positionXY(state.edge_margin
.addY(y_offset)
.addX(x_offset));
x_offset += item.lbl.text.len + 1;
if (x_offset > state.config.custom_bind_width) {
x_offset = 0;
y_offset += 1;
}
}
}
for (state.custom_info.items, 0..) |*item, i| {