diff --git a/src/core/hyprlock.cpp b/src/core/hyprlock.cpp index 87bbe79..8f31e4f 100644 --- a/src/core/hyprlock.cpp +++ b/src/core/hyprlock.cpp @@ -1138,7 +1138,7 @@ zwlr_screencopy_manager_v1* CHyprlock::getScreencopy() { } void CHyprlock::attemptRestoreOnDeath() { - if (m_bTerminate) + if (m_bTerminate || m_sCurrentDesktop != "Hyprland") return; const auto XDG_RUNTIME_DIR = getenv("XDG_RUNTIME_DIR"); @@ -1176,6 +1176,13 @@ void CHyprlock::attemptRestoreOnDeath() { ofs << timeNowMs; ofs.close(); + if (m_bLocked && m_sLockState.lock) { + ext_session_lock_v1_destroy(m_sLockState.lock); + + // Destroy sessionLockSurfaces + m_vOutputs.clear(); + } + spawnSync("hyprctl keyword misc:allow_session_lock_restore true"); - spawnAsync("sleep 2 && hyprlock --immediate --immediate-render & disown"); + spawnSync("hyprctl dispatch exec \"hyprlock --immediate --immediate-render\""); }