As of some time early this week, I noticed that my xidle screensaver
command is not running. [It may have happened before that, but if so I
didn't notice.]

If I hack xidle to turn on `DEBUG` it doesn't notice that the timeout
has been met, sitting there forever without running `program`:

```
$ make && ./xidle -no -program "/usr/bin/touch /tmp/t" -timeout 5
cc -O2 -pipe  -Wall  -MD -MP   -I/usr/X11R6/include -c xidle.c
cc   -o xidle xidle.o -L/usr/X11R6/lib -lXss -lXext -lX11 -lxcb -lXau -lXdmcp
Area: 2
Delay: 2
Position: 16
Timeout: 5
Program: "/usr/bin/touch"
```

However, if I send it `SIGUSR1` it wakes up:

```
got event 33
```

and runs the command.

So either xidle isn't tell X it wants to be woken up (and that part of
xidle's code hasn't changed in years), or X isn't sending it the wake up
event.

Running this C program in a loop confirms that the idle time is being
incremented/reset correctly:

```
#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/extensions/scrnsaver.h>
void main() {
    Display *d = XOpenDisplay("");
    XScreenSaverInfo inf;
    if (XScreenSaverQueryInfo(d, DefaultRootWindow(display), &inf))
        printf("%f\n", inf.idle / 1000.0);
    XCloseDisplay(display);
}
```

so it seems that XScreenSaver does have the right information.

FWIW, I had to make a patch against `xidle` for its DEBUG output to work
correctly (without this, the DEBUG output always goes to /dev/pull).
diff at the end of this email.


Laurie


diff --git app/xidle/xidle.c app/xidle/xidle.c
index 623ca784a..c302d710a 100644
--- app/xidle/xidle.c
+++ app/xidle/xidle.c
@@ -327,7 +331,9 @@ main(int argc, char **argv)
        char *args[10];
        int area = 2, delay = 2, timeout = 0;
        int position = north|west;
+#ifndef DEBUG
        int fd;
+#endif
        u_long last_serial = 0;
 
        parse_opts(argc, argv, &x.dpy, &area, &delay, &timeout,
@@ -345,6 +351,7 @@ main(int argc, char **argv)
        signal(SIGTERM, handler);
        signal(SIGUSR1, handler);
 
+#ifndef DEBUG
        fd = open(_PATH_DEVNULL, O_RDWR);
        if (fd < 0)
                err(1, _PATH_DEVNULL);
@@ -353,6 +360,7 @@ main(int argc, char **argv)
        dup2(fd, STDERR_FILENO);
        if (fd > 2)
                close(fd);
+#endif
 
        if (pledge("stdio proc exec", NULL) == -1)
                err(1, "pledge");

Reply via email to