Fix: Adding the battery_y usize condition separately due to comptime_int errors

This commit is contained in:
ebits 2025-10-23 09:09:40 +05:30
commit 4dfc3f3e12
3 changed files with 10 additions and 5 deletions

View file

@ -46,9 +46,6 @@ auth_fails = 10
# If set to null, battery status won't be shown
battery_id = null
# Set margin to the edges of the DM (useful for curved monitors)
edge_margin = 0
# Background color id
bg = 0x00000000
@ -141,6 +138,9 @@ doom_middle_color = 0x00C78F17
# DOOM animation custom bottom color (high intensity flames)
doom_bottom_color = 0x00FFFFFF
# Set margin to the edges of the DM (useful for curved monitors)
edge_margin = 0
# Error background color id
error_bg = 0x00000000

View file

@ -12,7 +12,6 @@ animation_timeout_sec: u12 = 0,
asterisk: ?u32 = '*',
auth_fails: u64 = 10,
battery_id: ?[]const u8 = null,
edge_margin: u8 = 0,
bg: u32 = 0x00000000,
bigclock: Bigclock = .none,
bigclock_12hr: bool = false,
@ -40,6 +39,7 @@ doom_fire_spread: u8 = 2,
doom_top_color: u32 = 0x00FF0000,
doom_middle_color: u32 = 0x00FFFF00,
doom_bottom_color: u32 = 0x00FFFFFF,
edge_margin: u8 = 0,
error_bg: u32 = 0x00000000,
error_fg: u32 = 0x01FF0000,
fg: u32 = 0x00FFFFFF,

View file

@ -598,7 +598,12 @@ pub fn main() !void {
var battery_buf: [16:0]u8 = undefined;
const battery_str = std.fmt.bufPrintZ(&battery_buf, "BAT: {d}%", .{battery_percentage}) catch break :draw_battery;
const battery_y: usize = if (config.hide_key_hints) config.edge_margin else config.edge_margin + 1;
var battery_y: usize = config.edge_margin;
if (!config.hide_key_hints) {
battery_y += 1;
} else {
battery_y = config.edge_margin;
}
buffer.drawLabel(battery_str, config.edge_margin, battery_y);
can_draw_battery = true;
}