How to inject fake keystrokes

Some special keys do not create keyboard events, but can be monitored by the tpb and KMilo programs. The latter can execute arbitrary commands. If you want to create a fake keystroke corresponding to the special key, you need to execute a command that generates a synthetic keyboard event.

Here is an example of such a program, which injects an Esc key press (the keycode constant KEYCODE_ESC = 9 was found using xev):