Is there no clean method of accessing the keyboard device or the mouse on linux? It seems that looking at /proc/interrupts might prove to be useful for keyboard monitoring. What about checking if the left mouse button is clicked or finding the position of the cursor on the screen?