diff --git a/src/managers/SessionLockManager.cpp b/src/managers/SessionLockManager.cpp index 1e366034..a0374b85 100644 --- a/src/managers/SessionLockManager.cpp +++ b/src/managers/SessionLockManager.cpp @@ -172,6 +172,17 @@ bool CSessionLockManager::isSurfaceSessionLock(wlr_surface* pSurface) { void CSessionLockManager::removeSessionLockSurface(SSessionLockSurface* pSLS) { std::erase_if(m_sSessionLock.vSessionLockSurfaces, [&](const auto& other) { return pSLS == other.get(); }); + + if (g_pCompositor->m_pLastFocus) + return; + + for (auto& sls : m_sSessionLock.vSessionLockSurfaces) { + if (!sls->mapped) + continue; + + g_pCompositor->focusSurface(sls->pWlrLockSurface->surface); + break; + } } void CSessionLockManager::activateLock() {