renderer: add lockdead_screen_delay (#8467)

This commit is contained in:
Alexandre Acebedo
2024-11-17 15:58:18 +00:00
committed by GitHub
parent af83c82513
commit 0ddbd1c3a4
5 changed files with 25 additions and 4 deletions

View File

@@ -57,6 +57,7 @@ void CSessionLockManager::onNewSessionLock(SP<CSessionLock> pLock) {
m_pSessionLock = std::make_unique<SSessionLock>();
m_pSessionLock->lock = pLock;
m_pSessionLock->mLockTimer.reset();
m_pSessionLock->listeners.newSurface = pLock->events.newLockSurface.registerListener([this](std::any data) {
auto SURFACE = std::any_cast<SP<CSessionLockSurface>>(data);
@@ -176,3 +177,12 @@ bool CSessionLockManager::isSessionLockPresent() {
bool CSessionLockManager::anySessionLockSurfacesPresent() {
return m_pSessionLock && std::ranges::any_of(m_pSessionLock->vSessionLockSurfaces, [](const auto& surf) { return surf->mapped; });
}
bool CSessionLockManager::shallConsiderLockMissing() {
if (!m_pSessionLock)
return false;
static auto LOCKDEAD_SCREEN_DELAY = CConfigValue<Hyprlang::INT>("misc:lockdead_screen_delay");
return m_pSessionLock->mLockTimer.getMillis() > *LOCKDEAD_SCREEN_DELAY;
}