1 2 3
xprintidle is a simple utility to query the X server for the user's idle time in milliseconds and print it to the standard output.