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) {
+9 -2
View File
@@ -1797,7 +1797,7 @@ is_plugin_daemon_alive(const char *plugin_name)
buf[i] = ' ';
}
buf[n] = '\0';
return (strstr(buf, "dwm-plugin") != NULL && strstr(buf, plugin_name) != NULL);
return (strstr(buf, plugin_name) != NULL);
}
static int preload_stagger_idx = 0;
@@ -1812,7 +1812,7 @@ host_spawn_plugin(const char *plugin_name, const char *arg)
return;
int stagger_ms = 600;
if (strcmp(plugin_name, "locker") == 0)
stagger_ms = 80;
stagger_ms = 20;
else if (strcmp(plugin_name, "dmenu") == 0)
stagger_ms = 150;
else
@@ -3082,6 +3082,13 @@ setup(void)
}
unlink("/tmp/sxmo_softkey_suppress");
unlink("/tmp/sxmo_softkey_state");
{
int lfd = open("/tmp/bananarchy_screen_locked", O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, 0644);
if (lfd >= 0) {
(void)write(lfd, "1\n", 2);
close(lfd);
}
}
load_plugins();
grabkeys();
focus(NULL);