Rename min_refresh_delta option to animation_frame_delay (closes #925)

Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
AnErrupTion
2026-02-09 11:38:56 +01:00
parent d1810d8c98
commit 99dba44e46
4 changed files with 18 additions and 10 deletions

View File

@@ -27,6 +27,9 @@ allow_empty_password = true
# dur_file -> .dur file format (https://github.com/cmang/durdraw/tree/master)
animation = none
# Delay between each animation frame in milliseconds
animation_frame_delay = 5
# Stop the animation after some time
# 0 -> Run forever
# 1..2e12 -> Stop the animation after this many seconds
@@ -291,9 +294,6 @@ margin_box_h = 2
# Main box vertical margin
margin_box_v = 1
# Event timeout in milliseconds
min_refresh_delta = 5
# Set numlock on/off at startup
numlock = false

View File

@@ -9,6 +9,7 @@ const DurOffsetAlignment = enums.DurOffsetAlignment;
allow_empty_password: bool = true,
animation: Animation = .none,
animation_frame_delay: u16 = 5,
animation_timeout_sec: u12 = 0,
asterisk: ?u32 = '*',
auth_fails: u64 = 10,
@@ -73,7 +74,6 @@ logout_cmd: ?[]const u8 = null,
ly_log: []const u8 = "/var/log/ly.log",
margin_box_h: u8 = 2,
margin_box_v: u8 = 1,
min_refresh_delta: u16 = 5,
numlock: bool = false,
path: ?[]const u8 = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
restart_cmd: []const u8 = "/sbin/shutdown -r now",

View File

@@ -153,6 +153,14 @@ pub fn configFieldHandler(_: std.mem.Allocator, field: ini.IniField) ?ini.IniFie
return field;
}
if (std.mem.eql(u8, field.key, "min_refresh_delta")) {
// The option has simply been renamed
var mapped_field = field;
mapped_field.key = "animation_frame_delay";
return mapped_field;
}
return field;
}

View File

@@ -916,7 +916,7 @@ pub fn main() !void {
// Calculate the maximum timeout based on current animations, or the (big) clock. If there's none, we wait for the event indefinitely instead
if (state.animate and !state.animation_timed_out) {
timeout = config.min_refresh_delta;
timeout = config.animation_frame_delay;
// Check how long we've been running so we can turn off the animation
const time = try interop.getTimeOfDay();
@@ -1132,7 +1132,7 @@ fn authenticate(ptr: *anyopaque) !bool {
);
};
state.info_line.label.draw();
_ = TerminalBuffer.presentBufferStatic();
TerminalBuffer.presentBufferStatic();
return false;
}
@@ -1154,7 +1154,7 @@ fn authenticate(ptr: *anyopaque) !bool {
);
};
state.info_line.label.draw();
_ = TerminalBuffer.presentBufferStatic();
TerminalBuffer.presentBufferStatic();
if (state.config.save) save_last_settings: {
// It isn't worth cluttering the code with precise error
@@ -1301,7 +1301,7 @@ fn authenticate(ptr: *anyopaque) !bool {
// Restore the cursor
TerminalBuffer.setCursorStatic(0, 0);
_ = TerminalBuffer.presentBufferStatic();
TerminalBuffer.presentBufferStatic();
return false;
}
@@ -1439,7 +1439,7 @@ fn drawUi(state: *UiState) !bool {
state.auth_fails = 0;
}
_ = TerminalBuffer.presentBufferStatic();
TerminalBuffer.presentBufferStatic();
return false;
}
@@ -1482,7 +1482,7 @@ fn drawUi(state: *UiState) !bool {
state.login.label.draw();
state.password.draw();
_ = TerminalBuffer.presentBufferStatic();
TerminalBuffer.presentBufferStatic();
return true;
}