SUMMARY: Finding idle time for auto xlock

From: Andrew Beckett (
Date: Fri Jun 03 1994 - 04:59:46 CDT

Original question:
> Dear sun-managers,
> To try to improve our security just a little bit, I have been trying to
> find a way to automatically run xlock on a machine when it has been "idle"
> for a certain period of time, in the same way that screenblank blanks the
> screen. The problem is that I can't find an appropriate system call or
> ioctl which will tell me this sort of information. Obviously it must be
> possible because screenblank, finger and w return it (it appears that
> the idle time on the console will do - wiggling the mouse seems to reset
> the idle time returned by finger).
> I've tried RTFM (including searches in Answerbook), including looking
> at kb and kbd drivers, but have so far drawn a blank.
> So I present two questions:
> 1. Is there any PD software out there which will do this?
> 2. Does anyone know how I can find out the idle time?
> Obviously I could get the server to run finger and look at the output, but
> that seems a rather tacky way of doing it to me!!

The answers:

   xautolock (the most popular reply)
   This runs your favourite locking program (xlock by default) after
   a specified period of inactivity (which it finds by some X trickery).
   This works on OpenWindows ok, and has cute features like being able to
   define a region in the corner of the screen where you can place your cursor
   to stop it from autolocking! Thanks to Jonathon Davis for sending me this,
   although it's available from your local archie.

   xscreensaver (mentioned by a few)
   This is a complete screen locking program with lots of different
   different patterns. Turned out that our Manchester site already had
   this (Thanks Ian). You can set a time for inactivity before it runs.
   However, it needs Motif libraries which don't normally come with OpenWindows,
   so be warned. It can also handle the XIdle feature of X11R5 (not in

   xlocktool (mentioned by two)
   Supposedly this is pretty good, but I haven't seen it.

   I'd actually worked out how to do this before any replies came.
   The answer is to use stat (2V) to find the access time on /dev/kbd
   and /dev/mouse & then subtract this from the current time, etc.
   Several sent me scripts or code fragments to do this, but it's pretty

Thanks to:

"Brian Decker" <>
"Frank 'Scruffy' Miller" <>
Brad Burdick <>
Christian Lawrence <>
Dan Stromberg - OAC-DCS <>
Gareth J McAleese <> (Gary Richardson)
James T Perkins <>
John DiMarco <>
Jonathan C. Davis <>
Markus Storm <>
Mike Raffety <>
Pat Cain - Denver <>
Ric Anderson <ric@Artisoft.COM>
Steve Swaney <>
Tim Rosmus <> (Werner Zuercher) (Andrew Beckett) (Adam Fox)
antonson@umiacs.UMD.EDU (Todd S. Antonson) (Ian Camm) (David H. Brierley) (Edward F Killian) (Glenn Satchell) (John E. Ivory)
javaid (Javaid Siddiqi) (Javaid Siddiqi) (Jeff Cummings) (Andy Kumeda) (Jeffrey D. LaCoursiere) (Nino Margetic) (Vince Reed -- "Sub Zero" ) (Bob Rutherford 965-0546)

* Andrew Beckett * *
* Senior Design Engineer * *
* Fujitsu Microelectronics Ltd * *
* Highway House * phone : (0628) 71116 *
* Norreys Drive * fax : (0628) 773990 *
* Maidenhead. Berks SL6 4BW * email : *

This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:09:02 CDT