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

@@ -25,15 +25,15 @@ else
CURRENT_STATE="$(sxmo_state.sh get)"
fi
if [ "$CURRENT_STATE" != "unlock" ] && sxmo_state.sh is_locked; then
if [ -f /tmp/bananarchy_screen_locked ] || { [ "$CURRENT_STATE" != "unlock" ] && sxmo_state.sh is_locked; }; then
case "$ACTION" in
"powerbutton_one"|"powerbutton_two"|"powerbutton_three"|"menuleft_one"|"menuright_one"|"enter_one"|"enter_two"|"enter_three")
if [ -n "$WAYLAND_DISPLAY" ]; then
wlopm --on "*" >/dev/null 2>&1 || sxmo_wm.sh display on
sxmo_wm.sh display on
if [ -f /tmp/bananarchy_screen_locked ]; then
xlocker wake >/dev/null 2>&1 &
else
sxmo_wm.sh display on
sxmo_state.sh set unlock &
fi
sxmo_state.sh set unlock &
exit 0
;;
"voldown_one"|"volup_one")
@@ -78,8 +78,9 @@ if sxmo_wakelock.sh isenabled; then
sxmo_wakelock.sh lock sxmo_not_suspendable infinite
fi
# To setup initial unlock state
sxmo_state.sh set unlock
# Activate lockscreen upon GUI startup
printf '1\n' > /tmp/bananarchy_screen_locked
sxmo_state.sh set lock
# Turn on lisgd only on touch devices
if [ -z "$SXMO_NO_VIRTUAL_KEYBOARD" ] && [ ! -e "$XDG_CACHE_HOME"/sxmo/sxmo.nogesture ]; then
@@ -97,6 +98,10 @@ fi
# Start the desktop widget (e.g. clock)
pidof -s conky >/dev/null 2>&1 || DISPLAY=:0 CONKY_DPY=:0 conky -c /home/user/.config/sxmo/conky.conf -d >/dev/null 2>&1 </dev/null || true
if [ -f /tmp/bananarchy_screen_locked ]; then
pkill -STOP -x conky 2>/dev/null || true
xlocker wake >/dev/null 2>&1 &
fi
# It watch network changes and update the status bar icon by example
superctl start sxmo_networkmonitor
@@ -25,15 +25,15 @@ else
CURRENT_STATE="$(sxmo_state.sh get)"
fi
if [ "$CURRENT_STATE" != "unlock" ] && sxmo_state.sh is_locked; then
if [ -f /tmp/bananarchy_screen_locked ] || { [ "$CURRENT_STATE" != "unlock" ] && sxmo_state.sh is_locked; }; then
case "$ACTION" in
"powerbutton_one"|"powerbutton_two"|"powerbutton_three"|"menuleft_one"|"menuright_one"|"enter_one"|"enter_two"|"enter_three")
if [ -n "$WAYLAND_DISPLAY" ]; then
wlopm --on "*" >/dev/null 2>&1 || sxmo_wm.sh display on
sxmo_wm.sh display on
if [ -f /tmp/bananarchy_screen_locked ]; then
xlocker wake >/dev/null 2>&1 &
else
sxmo_wm.sh display on
sxmo_state.sh set unlock &
fi
sxmo_state.sh set unlock &
exit 0
;;
"voldown_one"|"volup_one")
@@ -78,8 +78,9 @@ if sxmo_wakelock.sh isenabled; then
sxmo_wakelock.sh lock sxmo_not_suspendable infinite
fi
# To setup initial unlock state
sxmo_state.sh set unlock
# Activate lockscreen upon GUI startup
printf '1\n' > /tmp/bananarchy_screen_locked
sxmo_state.sh set lock
# Turn on lisgd only on touch devices
if [ -z "$SXMO_NO_VIRTUAL_KEYBOARD" ] && [ ! -e "$XDG_CACHE_HOME"/sxmo/sxmo.nogesture ]; then
@@ -97,6 +98,10 @@ fi
# Start the desktop widget (e.g. clock)
pidof -s conky >/dev/null 2>&1 || DISPLAY=:0 CONKY_DPY=:0 conky -c /home/user/.config/sxmo/conky.conf -d >/dev/null 2>&1 </dev/null || true
if [ -f /tmp/bananarchy_screen_locked ]; then
pkill -STOP -x conky 2>/dev/null || true
xlocker wake >/dev/null 2>&1 &
fi
# It watch network changes and update the status bar icon by example
superctl start sxmo_networkmonitor
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -15,6 +15,7 @@ cur_state=""
[ "$cur_state" = "unlock" ] && exit 0
printf '1\n' > /tmp/bananarchy_screen_locked
pkill -STOP -x conky 2>/dev/null || true
if [ -z "$SXMO_DISABLE_LEDS" ]; then
sxmo_led.sh blink blue &
@@ -4,4 +4,4 @@
# Copyright 2022 Sxmo Contributors
sxmo_jobs.sh stop idle_locker 2>/dev/null || true
sxmo_state.sh set unlock &
sxmo_state.sh set lock &
@@ -78,8 +78,9 @@ if sxmo_wakelock.sh isenabled; then
sxmo_wakelock.sh lock sxmo_not_suspendable infinite
fi
# To setup initial unlock state
sxmo_state.sh set unlock
# Activate lockscreen upon GUI startup
printf '1\n' > /tmp/bananarchy_screen_locked
sxmo_state.sh set lock
# Turn on lisgd only on touch devices
if [ -z "$SXMO_NO_VIRTUAL_KEYBOARD" ] && [ ! -e "$XDG_CACHE_HOME"/sxmo/sxmo.nogesture ]; then
@@ -97,6 +98,10 @@ fi
# Start the desktop widget (e.g. clock)
pidof -s conky >/dev/null 2>&1 || DISPLAY=:0 CONKY_DPY=:0 conky -c /home/user/.config/sxmo/conky.conf -d >/dev/null 2>&1 </dev/null || true
if [ -f /tmp/bananarchy_screen_locked ]; then
pkill -STOP -x conky 2>/dev/null || true
xlocker wake >/dev/null 2>&1 &
fi
# It watch network changes and update the status bar icon by example
superctl start sxmo_networkmonitor
@@ -14,6 +14,7 @@ if [ -z "$SXMO_DISABLE_LEDS" ]; then
fi
sxmo_wm.sh display on
pkill -CONT -x conky 2>/dev/null || true
if [ -z "$SXMO_NO_VIRTUAL_KEYBOARD" ]; then
sxmo_wm.sh inputevent touchscreen on
fi
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+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);