how to check mouse/keyboard activity w/o focus?

Ben Stringer ben at burbong.com
Tue Feb 17 23:11:24 UTC 2004


On Wed, 2004-02-18 at 00:44, gqin at fit.edu wrote:
> Hi, I am writing a code that can call a suspend command if there is low
> cpu activity and no mouse or keyboard activity for some time period. I
> wonder if there is a way to check the mouse and keyboard activity if the
> mouse/keyboard is not focussed on this object? Thanks.

Try the following - but note that the check itself will appear as
activity.

stat /dev/mouse
stat `tty`

The "access" time field will show last mouse time. You will need to
experiment with the keyboard - the `tty` given above probably won't cut
it.

Cheers, Ben
-- 
.O.    Ben Stringer
..O    ben at burbong.com
OOO    linux|java|majitek|gnu





More information about the users mailing list