reading idle time with perl/shell script
i'm looking to find a way to detect whether or not the user is idle (in terms of mouse and keyboard activity) from either a shell script or a perl script. i am running libranet with kde. a solution that applies to linux in general would be somewhat preferable so i could apply it to desktop environments other than kde in the future, but i would also be happy with a kde specific solution. if possible, it would also be nice to know how long the user has been idle, but it would be okay if it was a true/false response.