Add possibility to disable auth_fails animation (closes #835)

Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
AnErrupTion
2025-11-30 22:19:38 +01:00
parent 3dfb86fe69
commit 4df2382698
2 changed files with 6 additions and 5 deletions

View File

@@ -39,6 +39,7 @@ animation_timeout_sec = 0
asterisk = * asterisk = *
# The number of failed authentications before a special animation is played... ;) # The number of failed authentications before a special animation is played... ;)
# If set to 0, the animation will never be played
auth_fails = 10 auth_fails = 10
# Identifier for battery whose charge to display at top left # Identifier for battery whose charge to display at top left

View File

@@ -629,7 +629,7 @@ pub fn main() !void {
if (update) { if (update) {
// If the user entered a wrong password 10 times in a row, play a cascade animation, else update normally // If the user entered a wrong password 10 times in a row, play a cascade animation, else update normally
if (auth_fails >= config.auth_fails) { if (config.auth_fails > 0 and auth_fails >= config.auth_fails) {
std.Thread.sleep(std.time.ns_per_ms * 10); std.Thread.sleep(std.time.ns_per_ms * 10);
update = buffer.cascade(); update = buffer.cascade();
@@ -847,7 +847,7 @@ pub fn main() !void {
const time = try interop.getTimeOfDay(); const time = try interop.getTimeOfDay();
timeout = @intCast((60 - @rem(time.seconds, 60)) * 1000 - @divTrunc(time.microseconds, 1000) + 1); timeout = @intCast((60 - @rem(time.seconds, 60)) * 1000 - @divTrunc(time.microseconds, 1000) + 1);
} else if (config.clock != null or auth_fails >= config.auth_fails) { } else if (config.clock != null or (config.auth_fails > 0 and auth_fails >= config.auth_fails)) {
const time = try interop.getTimeOfDay(); const time = try interop.getTimeOfDay();
timeout = @intCast(1000 - @divTrunc(time.microseconds, 1000) + 1); timeout = @intCast(1000 - @divTrunc(time.microseconds, 1000) + 1);
@@ -1110,7 +1110,7 @@ pub fn main() !void {
try std.posix.tcsetattr(std.posix.STDIN_FILENO, .FLUSH, tb_termios); try std.posix.tcsetattr(std.posix.STDIN_FILENO, .FLUSH, tb_termios);
if (auth_fails < config.auth_fails) { if (config.auth_fails == 0 or auth_fails < config.auth_fails) {
_ = termbox.tb_clear(); _ = termbox.tb_clear();
try ttyClearScreen(); try ttyClearScreen();