From 5ab0ecb229f0aa40f82e487000310c93ebe5b262 Mon Sep 17 00:00:00 2001 From: nyraa <112930946+nyraa@users.noreply.github.com> Date: Wed, 10 Sep 2025 18:09:37 +0800 Subject: [PATCH] Add option for position of version string Version string is located at left top corner originally, but that will cause the first line labels too long and not easy to read. This commit add a option in config to decide which corner to display version string. --- res/config.ini | 3 +++ src/config/Config.zig | 1 + src/main.zig | 15 +++++++++++++-- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/res/config.ini b/res/config.ini index 539a425..9ef25fc 100644 --- a/res/config.ini +++ b/res/config.ini @@ -186,6 +186,9 @@ hide_borders = false # Remove version number from the top left corner hide_version_string = false +# Position of version string (0: top-left, 1: top-right, 2: bottom-left, 3: bottom-right) +version_string_pos = 0 + # Remove power management command hints hide_key_hints = false diff --git a/src/config/Config.zig b/src/config/Config.zig index fb782ac..a8b9f9f 100644 --- a/src/config/Config.zig +++ b/src/config/Config.zig @@ -48,6 +48,7 @@ gameoflife_frame_delay: usize = 6, gameoflife_initial_density: f32 = 0.4, hide_borders: bool = false, hide_version_string: bool = false, +version_string_pos: u8 = 0, hide_key_hints: bool = false, initial_info_text: ?[]const u8 = null, input_len: u8 = 34, diff --git a/src/main.zig b/src/main.zig index 65298ac..cd0f364 100644 --- a/src/main.zig +++ b/src/main.zig @@ -538,8 +538,19 @@ pub fn main() !void { if (!animation_timed_out) animation.draw(); if (!config.hide_version_string) { - buffer.drawLabel(ly_top_str, length, 0); - length += ly_top_str.len + 1; + switch (config.version_string_pos) { + // top-right + 1 => buffer.drawLabel(ly_top_str, buffer.width - ly_top_str.len, 0), + // bottom-left + 2 => buffer.drawLabel(ly_top_str, 0, buffer.height - 1), + // bottom-right + 3 => buffer.drawLabel(ly_top_str, buffer.width - ly_top_str.len, buffer.height - 1), + // top-left, default + else => { + buffer.drawLabel(ly_top_str, 0, 0); + length += ly_top_str.len + 1; + }, + } } if (config.bigclock != .none and buffer.box_height + (bigclock.HEIGHT + 2) * 2 < buffer.height) {