wanted: keyboard macros in X

I am interested in creating a keyboard macro where, say, the F5 key
would type the string "the" into whichever window currently had the
keyboard focus.  I can think of various approaches:

 (1) Write a sawfish lisp function that generates the "t", "h", and
     "e" key events, and bind the function to F5 through the sawfish
     keymap.  But, having read the sawfish manual, I am unsure how to
     insert events into the X event queue.

 (2) Bind F5 to a shell script which calls a primitive X command that
     types the "t", "h", and "e" keys.  But I am not aware of a shell
     command that can generate X events.

 (3) Run the application inside of one of those virtual X servers that
     itself runs inside of an X window, and perhaps accomplish the
     macro binding through the event forwarding that happens between
     the main and the subordinate X server; but I am not aware of a
     mechanism provided by X-based X servers, which tend to be pretty

Can anyone with more X knowledge suggest a way to accomplish this?  I
am quite surprised it is not easy to do, since having X or the window
manager support keyboard macros would seem a great boon for the many
applications which do not.

Brandon Craig Rhodes   brandon rhodesmill org   http://rhodesmill.org/brandon

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]