 <p>no idea if this helps, but I just found this in some code:</p> <pre><code> void XFakeKeypress(Display *display, int keysym) { XKeyEvent event; Window current_focus_window; int current_focus_revert; XGetInputFocus(/* display = */ display, /* focus_return = */ &current_focus_window, /* revert_to_return = */ &current_focus_revert); event.type = /* (const) */ KeyPress; event.display = display; event.window = current_focus_window; event.root = DefaultRootWindow(/* display = */ display); event.subwindow = /* (const) */ None; event.time = 1000 * time(/* tloc = */ NULL); event.x = 0; event.y = 0; event.x_root = 0; event.y_root = 0; event.state = /* (const) */ ShiftMask; event.keycode = XKeysymToKeycode(/* display = */ display, /* keysym = */ keysym); event.same_screen = /* (const) */ True; XSendEvent(/* display = */ display, /* w = (const) */ InputFocus, /* propagate = (const) */ True, /* event_mask = (const) */ KeyPressMask, /* event_send = */ (XEvent *)(&event)); event.type = /* (const) */ KeyRelease; event.time = 1000 * time(/* tloc = */ NULL); XSendEvent(/* display = */ display, /* w = (const) */ InputFocus, /* propagate = (const) */ True, /* event_mask = (const) */ KeyReleaseMask, /* event_send = */ (XEvent *)(&event)); } </code></pre>