# The global keyboard and mouse hook



## time1 (Dec 18, 2013)

Hello. I have a question, tell me how to put a global hook on the keyboard to get all the characters typed?  I want to implement my own version of the screensaver (with password for unlocking). If something is wrong immediately take action. Currently, there are two main variants for implementing it, such as a PHP script, for this should be a cmd command that returns the new characters entered since the previous call (and the command to begin the hook characters), say, is that command in the ports or may be already in FreeBSD installed?  And the second variant is to write the C program daemon with the global hook.

And tell me, how can I know how much time there was no  input activity on keyboard and mouse, maybe there is the sysctl variable that shows it (it's for the first variant)?


----------



## SirDice (Dec 19, 2013)

Would this be an X screensaver or a console one? For console have a look at the source for blank_saver.ko: /usr/src/sys/dev/syscons/blank/blank_saver.c.


----------

