core: make attemptRestoreOnDeath faster and hyprland exclusive (#506)

* core: make attemptRestoreOnDeath hyprland exclusive

* core: destoy lock and sessionLockSurfaces in attemptRestoreOnDeath
This commit is contained in:
Maximilian Seidler 2024-10-05 13:30:19 +00:00 committed by GitHub
parent d9c2a5e0b7
commit eb63207ef0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

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