From eb63207ef051c62fa2ab010b3f89da263a397329 Mon Sep 17 00:00:00 2001 From: Maximilian Seidler <78690852+PaideiaDilemma@users.noreply.github.com> Date: Sat, 5 Oct 2024 13:30:19 +0000 Subject: [PATCH] core: make attemptRestoreOnDeath faster and hyprland exclusive (#506) * core: make attemptRestoreOnDeath hyprland exclusive * core: destoy lock and sessionLockSurfaces in attemptRestoreOnDeath --- src/core/hyprlock.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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\""); }