This program generate key and mouse events and sends them to a window on X11.
Usage: xreplay window < commands

The name of the window is an extended regular expression, first match is used.
You can use "CurrentWindow" to send the events to the current window.

The events are read from stdin.
Spaces and newline characters are ignored.

Expected symbols are :

a key symbol from /usr/include/X11/keysymdef.h, without "XK_"

<=modifier> : apply the modifier to the next key
  modifier can be SHIFT,CTRL,ALT

<+modifier> : apply the modifier to all further key events

<-modifier> : cancel the modifier

<SETFOCUS> : set the focus to the current window

<SLEEP n> : sleep for n milliseconds

<WINDOW regexp> : use for the further events the window matching this extended regular expression

<MOUSE_BUTTON n> : simulate a click on the nth mouse button

<MOUSE_MOVE x,y> : simulate a mouse move by these offsets

<MOUSE_WARP_ASBOLUTE x,y> : move the mouse to these absolute coordinates

<MOUSE_WARP_RELATIVE x,y> : move the mouse to these coordinates, relative to the current window

Homepage: http://www.floc.net/xreplay
Build: ./configure && make

Example : echo -n "<=SHIFT>hello" | ./xreplay ".*Konsole"

Some code stolen from joy2key (send a key event) and lirc (get a window id)

It needs the X11 extensions to compile as it's using the XTest framework
for mouse events (package xlibs-dev on debian)

For some reasons it doesn't work with all programs and I have no idea why.
It works for konsole but not xterm, dillo and konqueror but not mozilla ...

You can compile it with "make debug" to have some debugging information
printed on stderr.

Leave a Comment

Your email address will not be published. Required fields are marked *