diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp
index 013d4a5..30d7b9f 100644
--- a/src/config/ConfigManager.cpp
+++ b/src/config/ConfigManager.cpp
@@ -125,6 +125,7 @@ void CConfigManager::init() {
m_config.addSpecialConfigValue("input-field", "check_color", Hyprlang::INT{0xFFCC8822});
m_config.addSpecialConfigValue("input-field", "fail_color", Hyprlang::INT{0xFFCC2222});
m_config.addSpecialConfigValue("input-field", "fail_text", Hyprlang::STRING{"$FAIL"});
+ m_config.addSpecialConfigValue("input-field", "fail_timeout", Hyprlang::INT{2000});
m_config.addSpecialConfigValue("input-field", "fail_transition", Hyprlang::INT{300});
m_config.addSpecialConfigValue("input-field", "capslock_color", Hyprlang::INT{-1});
m_config.addSpecialConfigValue("input-field", "numlock_color", Hyprlang::INT{-1});
@@ -277,6 +278,7 @@ std::vector CConfigManager::getWidgetConfigs() {
{"check_color", m_config.getSpecialConfigValue("input-field", "check_color", k.c_str())},
{"fail_color", m_config.getSpecialConfigValue("input-field", "fail_color", k.c_str())},
{"fail_text", m_config.getSpecialConfigValue("input-field", "fail_text", k.c_str())},
+ {"fail_timeout", m_config.getSpecialConfigValue("input-field", "fail_timeout", k.c_str())},
{"fail_transition", m_config.getSpecialConfigValue("input-field", "fail_transition", k.c_str())},
{"capslock_color", m_config.getSpecialConfigValue("input-field", "capslock_color", k.c_str())},
{"numlock_color", m_config.getSpecialConfigValue("input-field", "numlock_color", k.c_str())},
diff --git a/src/core/hyprlock.cpp b/src/core/hyprlock.cpp
index 5d0fb2b..1114f87 100644
--- a/src/core/hyprlock.cpp
+++ b/src/core/hyprlock.cpp
@@ -760,12 +760,6 @@ static const ext_session_lock_v1_listener sessionLockListener = {
// end session_lock
-static void displayFailTextTimerCallback(std::shared_ptr self, void* data) {
- g_pAuth->m_bDisplayFailText = false;
-
- g_pHyprlock->renderAllOutputs();
-}
-
void CHyprlock::onPasswordCheckTimer() {
// check result
if (g_pAuth->didAuthSucceed()) {
@@ -778,8 +772,6 @@ void CHyprlock::onPasswordCheckTimer() {
g_pAuth->m_bDisplayFailText = true;
forceUpdateTimers();
- g_pHyprlock->addTimer(/* controls error message duration */ std::chrono::seconds(1), displayFailTextTimerCallback, nullptr);
-
g_pAuth->start();
renderAllOutputs();
diff --git a/src/renderer/widgets/PasswordInputField.cpp b/src/renderer/widgets/PasswordInputField.cpp
index 4feb778..fab0cab 100644
--- a/src/renderer/widgets/PasswordInputField.cpp
+++ b/src/renderer/widgets/PasswordInputField.cpp
@@ -28,6 +28,7 @@ CPasswordInputField::CPasswordInputField(const Vector2D& viewport_, const std::u
rounding = std::any_cast(props.at("rounding"));
configPlaceholderText = std::any_cast(props.at("placeholder_text"));
configFailText = std::any_cast(props.at("fail_text"));
+ configFailTimeoutMs = std::any_cast(props.at("fail_timeout"));
col.transitionMs = std::any_cast(props.at("fail_transition"));
col.outer = std::any_cast(props.at("outer_color"));
col.inner = std::any_cast(props.at("inner_color"));
@@ -304,6 +305,11 @@ bool CPasswordInputField::draw(const SRenderData& data) {
return dots.currentAmount != passwordLength || fade.animated || col.animated || redrawShadow || data.opacity < 1.0 || forceReload;
}
+static void failTimeoutCallback(std::shared_ptr self, void* data) {
+ g_pAuth->m_bDisplayFailText = false;
+ g_pHyprlock->renderAllOutputs();
+}
+
void CPasswordInputField::updatePlaceholder() {
if (passwordLength != 0) {
if (placeholder.asset && /* keep prompt asset cause it is likely to be used again */ placeholder.isFailText) {
@@ -328,6 +334,7 @@ void CPasswordInputField::updatePlaceholder() {
placeholder.asset = nullptr;
if (placeholder.isFailText) {
+ g_pHyprlock->addTimer(std::chrono::milliseconds(configFailTimeoutMs), failTimeoutCallback, nullptr);
placeholder.currentText = configFailText;
replaceAll(placeholder.currentText, "$FAIL", AUTHFEEDBACK);
replaceAll(placeholder.currentText, "$ATTEMPTS", std::to_string(placeholder.failedAttempts));
diff --git a/src/renderer/widgets/PasswordInputField.hpp b/src/renderer/widgets/PasswordInputField.hpp
index a85f0a2..d1bbb73 100644
--- a/src/renderer/widgets/PasswordInputField.hpp
+++ b/src/renderer/widgets/PasswordInputField.hpp
@@ -39,6 +39,7 @@ class CPasswordInputField : public IWidget {
Vector2D configSize;
std::string halign, valign, configFailText, outputStringPort, configPlaceholderText;
+ uint64_t configFailTimeoutMs = 2000;
int outThick, rounding;