From 53eab432965ff4b6c4153fbc72750424872e2f52 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Fri, 1 Mar 2024 13:53:05 +0000 Subject: [PATCH] grace: unlock on key press fixes #110 --- src/core/hyprlock.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/core/hyprlock.cpp b/src/core/hyprlock.cpp index 07005b9..9794854 100644 --- a/src/core/hyprlock.cpp +++ b/src/core/hyprlock.cpp @@ -658,6 +658,11 @@ std::optional CHyprlock::passwordLastFailReason() { void CHyprlock::onKey(uint32_t key, bool down) { const auto SYM = xkb_state_key_get_one_sym(m_pXKBState, key + 8); + if (std::chrono::system_clock::now() < g_pHyprlock->m_tGraceEnd) { + unlockSession(); + return; + } + if (down && std::find(m_vPressedKeys.begin(), m_vPressedKeys.end(), key) != m_vPressedKeys.end()) { Debug::log(ERR, "Invalid key down event (key already pressed?)"); return;