Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So I'm writing a game, and I'm getting crashes very intermittently occuring on movement. I'm trying to get a backtrace out of gdb, but it's incredibly tedious to keep bumbling around, hoping to hit the bug. I want an application that will send random keyboard events (preferably a subset chosen by me) to an X application (an SDL window in this case).

I tried googling and searching SuperUser, but if such an application exists (as I am sure there is) the keywords I'm using aren't hitting it.

Thanks in advance.

share|improve this question
up vote 4 down vote accepted

What you're looking for is xdotool. It's a simple command-line program that can send various events (including key-presses) to X11.

Simply write a little script in the language of your choice to call

xdotool key [key to press]

You can also do separate keydown and keyup events, so you can simulate a user holding down a key.

share|improve this answer
Perfect! Thank you, kind sir. – Bernard Sep 25 '09 at 19:46

xwit is another scripting tool that allows sending / setting various X11 events. xwininfo is useful for gathering information (such as what window you're specifically interested in), and xmctrl allows scripting some X window manager actions as well.

share|improve this answer
I think you mean wmctrl, not xmctrl. – uli42 Aug 25 '14 at 19:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .