summaryrefslogtreecommitdiff
path: root/src/managers
diff options
context:
space:
mode:
authorAlexandre Acebedo <alexandre@acebedo.fr>2024-11-17 15:58:18 +0000
committerGitHub <noreply@github.com>2024-11-17 15:58:18 +0000
commit0ddbd1c3a40f921816a2c512f871f1e51aca8fe2 (patch)
tree40861337c4835c15febb4dcb2daaabe09232212b /src/managers
parentaf83c825138386d269d69b3ef755b844a2eacb22 (diff)
renderer: add lockdead_screen_delay (#8467)
Diffstat (limited to 'src/managers')
-rw-r--r--src/managers/SessionLockManager.cpp10
-rw-r--r--src/managers/SessionLockManager.hpp3
2 files changed, 13 insertions, 0 deletions
diff --git a/src/managers/SessionLockManager.cpp b/src/managers/SessionLockManager.cpp
index 1b28cc27..c7a5934a 100644
--- a/src/managers/SessionLockManager.cpp
+++ b/src/managers/SessionLockManager.cpp
@@ -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;
+} \ No newline at end of file
diff --git a/src/managers/SessionLockManager.hpp b/src/managers/SessionLockManager.hpp
index 9b3b882c..59090605 100644
--- a/src/managers/SessionLockManager.hpp
+++ b/src/managers/SessionLockManager.hpp
@@ -29,6 +29,7 @@ struct SSessionLockSurface {
struct SSessionLock {
WP<CSessionLock> lock;
+ CTimer mLockTimer;
std::vector<std::unique_ptr<SSessionLockSurface>> vSessionLockSurfaces;
std::unordered_map<uint64_t, CTimer> mMonitorsWithoutMappedSurfaceTimers;
@@ -61,6 +62,8 @@ class CSessionLockManager {
void onLockscreenRenderedOnMonitor(uint64_t id);
+ bool shallConsiderLockMissing();
+
private:
UP<SSessionLock> m_pSessionLock;