Activate passcode lockscreen immediately upon GUI startup on boot

This commit is contained in:
Luxferre committed 2026-10-30 09:34:09 +02:00
1 parent 8c2a337c0d
commit 8df412085b
53 files changed
+79 -22

No files matched your search

+18 -1
View File
@@ -295,6 +295,17 @@ int locker_run_main(int argc, char** argv) {
return 0;
}
int daemonLockFd = acquirePluginDaemonLock("locker");
if (daemonLockFd < 0) {
for (int i = 0; i < 10; ++i) {
::usleep(30000);
if (sendPluginCommand("locker", isPreload ? "NOP" : initCmd)) {
return 0;
}
}
return 0;
}
std::string daemonPidPath = getPluginDaemonPidPath("locker");
std::string activePidPath = getRuntimeFile("xlocker.pid");
writeIntFile(daemonPidPath, static_cast<int>(::getpid()));
@@ -528,6 +539,9 @@ int locker_run_main(int argc, char** argv) {
passcode.empty() ? "Sleep" : "Clear",
&theme.colYellow);
if (!isCallActiveOrRingingFast()) {
grabLockerInput();
}
neo.present();
};
@@ -616,7 +630,7 @@ int locker_run_main(int argc, char** argv) {
if (!isPreload) {
lockPhone(initCmd == "LOCK_BLANK");
} else if (::access(kLockFlagPath, F_OK) == 0) {
lockPhone(isScreenBlanked());
lockPhone(false);
}
int xfd = ConnectionNumber(dpy);
@@ -838,6 +852,9 @@ int locker_run_main(int argc, char** argv) {
if (fifoFd >= 0) {
::close(fifoFd);
}
if (daemonLockFd >= 0) {
::close(daemonLockFd);
}
::unlink(getPluginFifoPath("locker").c_str());
::unlink(daemonPidPath.c_str());
return 0;
+18 -2
View File
@@ -24,6 +24,7 @@
#include <poll.h>
#include <sstream>
#include <string>
#include <sys/file.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/wait.h>
@@ -178,8 +179,23 @@ inline bool isPluginDaemonAlive(const char* name) {
}
}
buf[n] = '\0';
return (std::strstr(buf, "dwm-plugin") != nullptr &&
std::strstr(buf, name) != nullptr);
return (std::strstr(buf, name) != nullptr);
}
inline int acquirePluginDaemonLock(const char* name) {
if (!name || !name[0]) {
return -1;
}
std::string lockPath = std::string("/tmp/dwm_plugin_") + name + ".lock";
int fd = ::open(lockPath.c_str(), O_RDWR | O_CREAT | O_CLOEXEC, 0666);
if (fd < 0) {
return -1;
}
if (::flock(fd, LOCK_EX | LOCK_NB) != 0) {
::close(fd);
return -1;
}
return fd;
}
inline bool sendPluginCommand(const char* name, const std::string& cmdLine) {