start: re-show display lock died screen on restart after crash (#15334)

* fix: display lock died screen on restart after crash

* refactor to expose events in SessionLockManager and listen from Compositor

* update Hyprland CLI help output

* add clearSessionLock() and fix allow_session_lock_restore

* implement --locked CLI flag

* exec lockscreen directly without lua

* separate --locked into --locked-cmd and --locked

* fix clang-format problems
This commit is contained in:
Neal
2026-07-11 16:43:04 +02:00
committed by GitHub
parent 128b2d5050
commit 10a34c4c2b
12 changed files with 139 additions and 15 deletions
+20 -3
View File
@@ -25,13 +25,16 @@ using namespace Hyprutils::OS;
using namespace std::string_literals;
//
void CHyprlandInstance::runHyprlandThread(bool safeMode) {
void CHyprlandInstance::runHyprlandThread(bool safeMode, bool lockedCrash) {
std::vector<std::string> argsStd;
argsStd.emplace_back("--watchdog-fd");
argsStd.emplace_back(std::format("{}", m_toHlPid.get()));
if (safeMode)
argsStd.emplace_back("--safe-mode");
if (lockedCrash)
argsStd.emplace_back("--locked");
for (const auto& a : g_state->rawArgvNoBinPath) {
argsStd.emplace_back(a);
}
@@ -134,10 +137,22 @@ void CHyprlandInstance::dispatchHyprlandEvent() {
m_hyprlandExiting = true;
continue;
}
if (sv == "lock") {
// session locked
m_hyprlandLocked = true;
continue;
}
if (sv == "unlock") {
// session unlocked
m_hyprlandLocked = false;
continue;
}
}
}
bool CHyprlandInstance::run(bool safeMode) {
bool CHyprlandInstance::run(bool safeMode, bool lockedCrash) {
int pipefds[2];
if (pipe(pipefds) != 0) {
g_logger->log(Hyprutils::CLI::LOG_ERR, "pipe() failed, exiting");
@@ -159,7 +174,9 @@ bool CHyprlandInstance::run(bool safeMode) {
m_wakeupRead.setFlags(m_wakeupRead.getFlags() | FD_CLOEXEC);
m_wakeupWrite.setFlags(m_wakeupWrite.getFlags() | FD_CLOEXEC);
runHyprlandThread(safeMode);
m_hyprlandLocked = lockedCrash;
runHyprlandThread(safeMode, lockedCrash);
pollfd pollfds[2] = {
{
+4 -2
View File
@@ -14,11 +14,13 @@ class CHyprlandInstance {
CHyprlandInstance(CHyprlandInstance&) = delete;
CHyprlandInstance(CHyprlandInstance&&) = delete;
bool run(bool safeMode = false); // if returns false, restart.
bool run(bool safeMode = false, bool lockedCrash = false); // if returns false, restart.
void forceQuit();
bool m_hyprlandLocked = false;
private:
void runHyprlandThread(bool safeMode);
void runHyprlandThread(bool safeMode, bool lockedCrash);
void clearFd(const Hyprutils::OS::CFileDescriptor& fd);
void dispatchHyprlandEvent();
+5 -2
View File
@@ -101,10 +101,13 @@ int main(int argc, const char** argv, const char** envp) {
if (Nix::shouldUseNixGL())
g_logger->log(Hyprutils::CLI::LOG_DEBUG, "Hyprland was compiled with Nix - will use nixGL");
bool safeMode = false;
bool safeMode = false;
bool lockedCrash = false;
while (true) {
g_instance = makeUnique<CHyprlandInstance>();
const bool RET = g_instance->run(safeMode);
const bool RET = g_instance->run(safeMode, lockedCrash);
lockedCrash = g_instance->m_hyprlandLocked;
g_instance.reset();
if (!RET) {