diff --git a/src/core/Hypridle.cpp b/src/core/Hypridle.cpp index 5edc32f..3519a9d 100644 --- a/src/core/Hypridle.cpp +++ b/src/core/Hypridle.cpp @@ -269,17 +269,22 @@ void CHypridle::onIdled(SIdleListener* pListener) { } Debug::log(LOG, "Running {}", pListener->onTimeout); + pListener->onTimeoutFired = true; spawn(pListener->onTimeout); } void CHypridle::onResumed(SIdleListener* pListener) { Debug::log(LOG, "Resumed: rule {:x}", (uintptr_t)pListener); isIdled = false; - if (g_pHypridle->m_iInhibitLocks > 0 && !pListener->ignoreInhibit) { - Debug::log(LOG, "Ignoring from onResumed(), inhibit locks: {}", g_pHypridle->m_iInhibitLocks); + + // If on-timeout never actually executed (was inhibited), skip on-resume too + if (!pListener->onTimeoutFired) { + Debug::log(LOG, "Skipping onResumed: onTimeout was inhibited for rule {:x}", (uintptr_t)pListener); return; } + pListener->onTimeoutFired = false; + if (pListener->onRestore.empty()) { Debug::log(LOG, "Ignoring, onRestore is empty."); return; diff --git a/src/core/Hypridle.hpp b/src/core/Hypridle.hpp index 11bab5d..c64d95b 100644 --- a/src/core/Hypridle.hpp +++ b/src/core/Hypridle.hpp @@ -17,10 +17,11 @@ class CHypridle { CHypridle(); struct SIdleListener { - SP notification = nullptr; - std::string onTimeout = ""; - std::string onRestore = ""; - bool ignoreInhibit = false; + SP notification = nullptr; + std::string onTimeout = ""; + std::string onRestore = ""; + bool ignoreInhibit = false; + bool onTimeoutFired = false; }; struct SDbusInhibitCookie {