From 4dfc3f3e122f954cf92a9aa38431130330ab88ec Mon Sep 17 00:00:00 2001 From: ebits Date: Thu, 23 Oct 2025 09:09:40 +0530 Subject: [PATCH] Fix: Adding the battery_y usize condition separately due to comptime_int errors --- res/config.ini | 6 +++--- src/config/Config.zig | 2 +- src/main.zig | 7 ++++++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/res/config.ini b/res/config.ini index 0ffe776..9b67388 100644 --- a/res/config.ini +++ b/res/config.ini @@ -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 diff --git a/src/config/Config.zig b/src/config/Config.zig index bf6aba3..8f95627 100644 --- a/src/config/Config.zig +++ b/src/config/Config.zig @@ -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, diff --git a/src/main.zig b/src/main.zig index e40e09a..2e1675d 100644 --- a/src/main.zig +++ b/src/main.zig @@ -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; }