Synthesizing keyboard events

Troy tjk at
Tue Dec 12 00:28:51 PST 2006

An idea would be to use XRebindKeysym to tie an unused 
keycode to the string "@" and then Use XSendEvent and event type 
XKeyPressedEvent to send the event. 

No time to test this, sorry. Seems like it should work, though.

Troy Korjuslommi                Tksoft Inc.
tjk at

> Hi,
> We would like to synthesize keyboard events.  For instance, synthesize
> typing XK_at.  The problem we encounter is that on a lot of keyboards,
> this is not available directly, but in combination with some modifiers.
> - Calling XKeysymToKeycode(XK_at) is not sufficient, since it doesn't
> give us the modifier mask to synthesize.
> - Looping calling XKeycodeToKeysym() doesn't seem to be very useful: one
> can one know the modifiers for reaching the given index?
> - One possibility would be to call XkbTranslateKeycode() with every
> modifier combination until one is found, but that's a bit slow...
> Is there any direct way to get the keycode and modifier mask to be
> synthesized?
> Samuel
> _______________________________________________
> xorg mailing list
> xorg at

More information about the xorg mailing list