From a9d39aef9b5bf1cae2d944ac7a23576f3a3768db Mon Sep 17 00:00:00 2001 From: MartorSkull Date: Fri, 1 May 2026 18:32:04 +0200 Subject: [PATCH] PR comments --- res/config.ini | 12 ++++++------ src/config/Config.zig | 4 ++-- src/main.zig | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/res/config.ini b/res/config.ini index 6b4954d..9d4913b 100644 --- a/res/config.ini +++ b/res/config.ini @@ -97,17 +97,17 @@ blank_box = true # Border foreground color id border_fg = 0x00FFFFFF -# Title to show at the top of the main box -# If set to null, none will be shown -box_title = null - # Relative horizontal position from the end of the screen # default: 0.5 (center) -box_h_position = 0.5 +box_position_h = 0.5 # Relative vertical position from the bottom of the screen # default: 0.5 (center) -box_v_position = 0.5 +box_position_v = 0.5 + +# Title to show at the top of the main box +# If set to null, none will be shown +box_title = null # Brightness decrease command brightness_down_cmd = $PREFIX_DIRECTORY/bin/brightnessctl -q -n s 10%- diff --git a/src/config/Config.zig b/src/config/Config.zig index b1a1771..65dbee0 100644 --- a/src/config/Config.zig +++ b/src/config/Config.zig @@ -23,9 +23,9 @@ bigclock_12hr: bool = false, bigclock_seconds: bool = false, blank_box: bool = true, border_fg: u32 = 0x00FFFFFF, +box_position_h: f32 = 0.5, +box_position_v: f32 = 0.5, box_title: ?[]const u8 = null, -box_h_position: f32 = 0.5, -box_v_position: f32 = 0.5, brightness_down_cmd: [:0]const u8 = build_options.prefix_directory ++ "/bin/brightnessctl -q -n s 10%-", brightness_down_key: ?[]const u8 = "F5", brightness_up_cmd: [:0]const u8 = build_options.prefix_directory ++ "/bin/brightnessctl -q -n s +10%", diff --git a/src/main.zig b/src/main.zig index 6a08ce4..362dab3 100644 --- a/src/main.zig +++ b/src/main.zig @@ -1981,9 +1981,9 @@ fn positionWidgets(ptr: *anyopaque) !void { bb_width = @min(bb_width, state.buffer.width - 2); const v_space: f32 = @floatFromInt(state.buffer.height - bb_height); - const v_position: usize = @intFromFloat(@min(@max(1.0, v_space * state.config.box_v_position), max_v_position)); + const v_position: usize = @intFromFloat(std.math.clamp(v_space * state.config.box_position_v, 1.0, max_v_position)); const h_space: f32 = @floatFromInt(state.buffer.width - bb_width); - const h_position: usize = @intFromFloat(@min(@max(1.0, h_space * state.config.box_h_position), max_h_position)); + const h_position: usize = @intFromFloat(std.math.clamp(h_space * state.config.box_position_h, 1.0, max_h_position)); if (state.config.bigclock != .none) { state.bigclock_label.positionXY(TerminalBuffer.START_POSITION