Hi,

I am looking at a way to auto-logout some workstation on inactivity.

xidle(1) seems great for such purpose. But I didn't found a way to just
use timeout and not also an active area (a corner where the program is
launched if pointer stays inside few seconds).

The following diff tries to implement a way to disable the active area
without being too intrusive.

For that, I used the `delay' parameter ("Specify the number of seconds
the pointer has to be in the given position before running the
program."), to allow value -1, and make it to discard the event.

Does it make sens ? Or any proposition to more straighfull approch ?

Thanks.
-- 
Sebastien Marie


Index: xidle.1
===================================================================
RCS file: /cvs/xenocara/app/xidle/xidle.1,v
retrieving revision 1.4
diff -u -p -r1.4 xidle.1
--- xidle.1     9 Nov 2017 19:13:03 -0000       1.4
+++ xidle.1     16 Jul 2018 09:25:40 -0000
@@ -63,6 +63,7 @@ The default is 2 pixels.
 Specify the number of seconds the pointer has to be in the given position
 before running the program.
 The default is 2 seconds.
+The value -1 makes the activation of program on position to be disabled.
 .It Fl display Ar display
 This argument allows you to specify the server to connect to; see
 .Xr X 7 .
Index: xidle.c
===================================================================
RCS file: /cvs/xenocara/app/xidle/xidle.c,v
retrieving revision 1.5
diff -u -p -r1.5 xidle.c
--- xidle.c     20 Aug 2017 16:43:25 -0000      1.5
+++ xidle.c     16 Jul 2018 09:23:18 -0000
@@ -303,7 +303,7 @@ fail:                       errx(1, "illegal value -- %s", (
        }
        if (getres(&value, rdb, "delay", "Delay")) {
                *delay = strtol((char *)value.addr, &p, 10);
-               if (*p || *delay < 0)
+               if (*p || *delay < -1)
                        goto fail;
        }
        if (getres(&value, rdb, "position", "Position")) {
@@ -414,6 +414,9 @@ main(int argc, char **argv)
                        break;
 
                case EnterNotify:
+                       if (delay == -1)
+                               break;
+
                        sleep(delay);
 
                        XQueryPointer(x.dpy, x.win, &ev.xcrossing.root,

Reply via email to