From 4df2382698e21eb67da609ceecc2c9dccf69b7f4 Mon Sep 17 00:00:00 2001 From: AnErrupTion Date: Sun, 30 Nov 2025 22:19:38 +0100 Subject: [PATCH] Add possibility to disable auth_fails animation (closes #835) Signed-off-by: AnErrupTion --- res/config.ini | 5 +++-- src/main.zig | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/res/config.ini b/res/config.ini index 1757303..2e3579e 100644 --- a/res/config.ini +++ b/res/config.ini @@ -39,6 +39,7 @@ animation_timeout_sec = 0 asterisk = * # The number of failed authentications before a special animation is played... ;) +# If set to 0, the animation will never be played auth_fails = 10 # Identifier for battery whose charge to display at top left @@ -162,7 +163,7 @@ 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) +# Set margin to the edges of the DM (useful for curved monitors) edge_margin = 0 # Error background color id @@ -213,7 +214,7 @@ gameoflife_frame_delay = 6 gameoflife_initial_density = 0.4 # Command executed when pressing hibernate key (can be null) -hibernate_cmd = null +hibernate_cmd = null # Specifies the key used for hibernate (F1-F12) hibernate_key = F4 diff --git a/src/main.zig b/src/main.zig index 4b882a9..dffd8fe 100644 --- a/src/main.zig +++ b/src/main.zig @@ -629,7 +629,7 @@ pub fn main() !void { if (update) { // 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); update = buffer.cascade(); @@ -847,7 +847,7 @@ pub fn main() !void { const time = try interop.getTimeOfDay(); 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(); 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); - if (auth_fails < config.auth_fails) { + if (config.auth_fails == 0 or auth_fails < config.auth_fails) { _ = termbox.tb_clear(); try ttyClearScreen();