xsendkeycode(8) send a key event to X using a keycode


xsendkeycode keycode 1|0


xsendkeycode is a simple program which allows you to send a keycode to X specifying a KeyPress or KeyRelease type of event.

A KeyPress event tells X that the key is being held down. A KeyRelease event tells X that the key has been released. A KeyRelease event is not as critical if you are sending a single alpha-numeric character. However, if you are sending modifier keys such as Shift, Control or Alt then make sure that you send the corresponding key up event or you will proceed as if those keys are being held down.

For example: xsendkeycode 38 1

will send the letter 'a'. If you wanted to send a capital letter a 'A' you would run these commands at the shell:

xsendkeycode 50 1; xsendkeycode 38 1; xsendkeycode 38 0; xsendkeycode 50 0;

The first command sends keycode 50 as a KeyPress. Keycode 50 is the left shift 'Shift_L' key. The second command sends a KeyPress 'a' event. The last two commands send the corresponding KeyRelease events. Notice the order. The 'a' key comes up before the 'Shift_L' key.

This helper application is not used from lineakd(1) but is included to allow scripts to send keys. This is especially helpful for people who's keyboards send ACPI events instead of actual KeyCodes.


xsendkeycode was written by Aivils <[email protected]>.