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 = *
# 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

View File

@@ -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();