<p>I need a way to detect mouse/keyboard activity on Linux. Something similar to what any IM program would do. If no activity is detected for, say 5 minutes, it will set your IM status to "I'm not here right now".</p>

<p>Any help towards this is appreciated.</p>

<p>Thanks.</p>

Try executing
```
who -u -H
```
at the command line. It will tell you who's logged in and how long they've been idle. At least users logged in to a terminal; I don't think it works at all in X. Anyhow, with this information you can tell who's idle or not and take actions appropriately.
If you're in X you could create a script to run as a screen saver or something like that.