google / xsecurelock

X11 screen lock utility with security in mind
Apache License 2.0
863 stars 65 forks source link

Screensaver not showing on initial blank #166

Open bsdice opened 1 year ago

bsdice commented 1 year ago

Hi, happy 2023 :)

I run i3 on Arch and since update from 1.7.0 to 1.8.0 xsecurelock is broken in the way, that a defined screensaver is not showing when the X11 screensaver timer initially expires. The screen is kept on, until XSECURELOCK_BLANK_TIMEOUT expires, but remains otherwise blank. The defined screensaver will show on first key press for the password entry dialog. I have this in i3's config:

exec_always --no-startup-id xset s 900 0
exec_always --no-startup-id xset dpms 0 0 0
exec_always --no-startup-id "while killall xss-lock 2>/dev/null; do sleep 0.1; done; \
        xss-lock -l -- env \
                XSECURELOCK_SWITCH_USER_COMMAND=\"dm-tool switch-to-greeter\" \
                XSECURELOCK_SAVER=$HOME/.config/i3/xscreensaver \
                XSECURELOCK_SAVER_RESET_ON_AUTH_CLOSE=1 \
                XSECURELOCK_FONT=\"Noto Sans:size=24\" \
                XSECURELOCK_DISCARD_FIRST_KEYPRESS=0 \
                XSECURELOCK_AUTH_BACKGROUND_COLOR=#000060 \
                XSECURELOCK_AUTH_CURSOR_BLINK=0 \
                XSECURELOCK_AUTH_TIMEOUT=10 \
                XSECURELOCK_BLANK_DPMS_STATE=off \
                XSECURELOCK_BLANK_TIMEOUT=120 \
                XSECURELOCK_SHOW_KEYBOARD_LAYOUT=0 \
                XSECURELOCK_SHOW_USERNAME=0 \
                xsecurelock &"

I bisected my problem and the causal commit is: https://github.com/google/xsecurelock/commit/0857969bf327227b4dc3eb5fa914e58df40ebd27

When I back it out like this

+++ main.c  2023-01-01 19:03:24.586980070 +0100
@@ -1106,7 +1106,7 @@ int main(int argc, char **argv) {

   // Figure out the initial Xss saver state. This gets updated by event.
   enum WatchChildrenState xss_requested_saver_state = WATCH_CHILDREN_NORMAL;
-#ifdef HAVE_XSCREENSAVER_EXT
+#if 0
   if (scrnsaver_event_base != 0) {
     XScreenSaverInfo *info = XScreenSaverAllocInfo();
     XScreenSaverQueryInfo(display, root_window, info);

the problem is no longer there. The goal is to have the screensaver come up after some time, simultaneously lock the screen, and if I am away for longer, use DPMS to turn off the screen to save energy.