Updated 2012-11-12 10:57:25 by APN

A package corresponding to TIP 245 that gives you the amount of time a user has been inactive.

davidw - I packaged up the code I found in the TIP proposal patch and have put it at http://www.dedasys.com/freesoftware/files/ (look for tkinactive). It's in an initial "it works for me" state, but could probably use more fixing, and could certainly use someone with MacOS X expertise to add that bit back in (I don't have a Mac system to do the work on). Currently supports Linux and Windows (with some manual build steps).

This library was adjusted for TEA 3.5 and built for Win32 by kostix. Fixed sources and the Win32 binary build are available from [1].

Works like so:
tkinactive ?-displayof window? ?reset?

and returns the inactive time in milliseconds.

Note that TIP 245 is implemented in Tk 8.5 so it has built-in support for user idle time reporting via its tk inactive command, hence consider using this library only if you must support Tk < 8.5.

Note that under Windows this package requires the availability of the SendInput system call which isn't available in all versions of Windows. It cannot work at all on 9x series of Windows, and on NT-based versions the requirements are: Service pack 3 for Windows NT, Windows XP and above. (DKF: These days, that's just about everyone though. Tcl/Tk's not really supported any further back either.)

Other idle time tracking facilities:


ccbbaa - 2009-11-29 16:36:02

the following code resets the screen saver on Xorg with tk 8.5 and kde. Should also work on windows. (update: it does work on XP and Vista at least)
proc timer {} {
  tk inactive reset
  after 5000 timer
}
timer

TWAPI provides the get_input_idle_time command on Windows.