xprintidle is a small program that prints the user's idle time to stdout, using the X screensaver extension. It is meant for use in scripts.