mirror of
https://github.com/hyprwm/hypridle.git
synced 2024-12-22 13:39:47 +01:00
fix: repoll after inhibitor idled (#15)
* yep, but how to trigger it? * stupid yet works * forgot about lock
This commit is contained in:
parent
790988d116
commit
afee84925a
4 changed files with 16 additions and 3 deletions
|
@ -80,6 +80,10 @@ std::vector<CConfigManager::STimeoutRule> CConfigManager::getRules() {
|
||||||
return m_vRules;
|
return m_vRules;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string CConfigManager::getOnTimeoutCommand() {
|
||||||
|
return m_vRules.front().onTimeout;
|
||||||
|
}
|
||||||
|
|
||||||
void* const* CConfigManager::getValuePtr(const std::string& name) {
|
void* const* CConfigManager::getValuePtr(const std::string& name) {
|
||||||
return m_config.getConfigValuePtr(name.c_str())->getDataStaticPtr();
|
return m_config.getConfigValuePtr(name.c_str())->getDataStaticPtr();
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ class CConfigManager {
|
||||||
std::string onResume = "";
|
std::string onResume = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
std::string getOnTimeoutCommand();
|
||||||
std::vector<STimeoutRule> getRules();
|
std::vector<STimeoutRule> getRules();
|
||||||
void* const* getValuePtr(const std::string& name);
|
void* const* getValuePtr(const std::string& name);
|
||||||
|
|
||||||
|
|
|
@ -261,7 +261,7 @@ static void spawn(const std::string& args) {
|
||||||
|
|
||||||
void CHypridle::onIdled(SIdleListener* pListener) {
|
void CHypridle::onIdled(SIdleListener* pListener) {
|
||||||
Debug::log(LOG, "Idled: rule {:x}", (uintptr_t)pListener);
|
Debug::log(LOG, "Idled: rule {:x}", (uintptr_t)pListener);
|
||||||
|
isIdled = true;
|
||||||
if (g_pHypridle->m_iInhibitLocks > 0) {
|
if (g_pHypridle->m_iInhibitLocks > 0) {
|
||||||
Debug::log(LOG, "Ignoring from onIdled(), inhibit locks: {}", g_pHypridle->m_iInhibitLocks);
|
Debug::log(LOG, "Ignoring from onIdled(), inhibit locks: {}", g_pHypridle->m_iInhibitLocks);
|
||||||
return;
|
return;
|
||||||
|
@ -278,7 +278,7 @@ void CHypridle::onIdled(SIdleListener* pListener) {
|
||||||
|
|
||||||
void CHypridle::onResumed(SIdleListener* pListener) {
|
void CHypridle::onResumed(SIdleListener* pListener) {
|
||||||
Debug::log(LOG, "Resumed: rule {:x}", (uintptr_t)pListener);
|
Debug::log(LOG, "Resumed: rule {:x}", (uintptr_t)pListener);
|
||||||
|
isIdled = false;
|
||||||
if (g_pHypridle->m_iInhibitLocks > 0) {
|
if (g_pHypridle->m_iInhibitLocks > 0) {
|
||||||
Debug::log(LOG, "Ignoring from onResumed(), inhibit locks: {}", g_pHypridle->m_iInhibitLocks);
|
Debug::log(LOG, "Ignoring from onResumed(), inhibit locks: {}", g_pHypridle->m_iInhibitLocks);
|
||||||
return;
|
return;
|
||||||
|
@ -301,8 +301,15 @@ void CHypridle::onInhibit(bool lock) {
|
||||||
// you have been warned.
|
// you have been warned.
|
||||||
m_iInhibitLocks = 0;
|
m_iInhibitLocks = 0;
|
||||||
Debug::log(WARN, "BUG THIS: inhibit locks < 0. Brought back to 0.");
|
Debug::log(WARN, "BUG THIS: inhibit locks < 0. Brought back to 0.");
|
||||||
} else
|
} else if (m_iInhibitLocks > 0) {
|
||||||
Debug::log(LOG, "Inhibit locks: {}", m_iInhibitLocks);
|
Debug::log(LOG, "Inhibit locks: {}", m_iInhibitLocks);
|
||||||
|
} else {
|
||||||
|
Debug::log(LOG, "Inhibit locks: {}", m_iInhibitLocks);
|
||||||
|
if (isIdled && lock) {
|
||||||
|
Debug::log(LOG, "Running from onInhibit() isIdled = true {}", g_pConfigManager->getOnTimeoutCommand());
|
||||||
|
spawn(g_pConfigManager->getOnTimeoutCommand());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CHypridle::SDbusInhibitCookie CHypridle::getDbusInhibitCookie(uint32_t cookie) {
|
CHypridle::SDbusInhibitCookie CHypridle::getDbusInhibitCookie(uint32_t cookie) {
|
||||||
|
|
|
@ -42,6 +42,7 @@ class CHypridle {
|
||||||
void enterEventLoop();
|
void enterEventLoop();
|
||||||
|
|
||||||
bool m_bTerminate = false;
|
bool m_bTerminate = false;
|
||||||
|
bool isIdled = false;
|
||||||
int64_t m_iInhibitLocks = 0;
|
int64_t m_iInhibitLocks = 0;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
|
Loading…
Reference in a new issue