I want to know which files belong to keystrokes and mouse clicks, and what kind of data is sent to them.My main purpose of asking this question is key logging. I want to write a key logger script that does some tasks like below:  Everywhere I type a special word, I can run a command in background. For example, when I type Firefox, everywhere in the OS, Firefox is opened, unless I hold down some special key like alt key.I can have a comprehensive log file of the key strokes and mouse clicks.When I have changed input language of keyboard and a special program, i.e. terminal, is open, it automatically changes the language to English.( I don't mean changing the input language, I mean a script that changes the other-language key strokes so that the program thinks it is in English language.)I also want to detect key loggings in my system (if any) by knowing which files a key logger needs to track.   Notes:  I want to do key logging in the lowest run levels. The lower the runlevel is, the better my problem is solved.   I have also read some questions like Unix User LevelKeylogger, but these questions    have some limitations, i.e.key logging only occurs in terminal. I don't want to use commands like script.  I    want to do key logging inthe deep, comprehensive way and without limitations.There may be other and better ways to do the things I have listed above. But as I have said, I my purpose is to learn key logging and know more about files which relate to keyboard and mouse input.)I know that my question may have a long answer. If so, I want to know the following: What files belong to key strokes?What files belong to the mouse clicks?( This one is less importantthan previous.)What kind of data is sent to these files?What commands may help me so I can reach my purposes I had listed above?
To which files does the key stroke and mouse click data go first and what form they have?
keyboard;filenames;command;mouse;file format