-   Linux - Software (
-   -   simulated keyboard inputs under Linux (

MrUmunhum 07-04-2008 01:37 PM

simulated keyboard inputs under Linux
Hi group,

I'm looking for a program or API that will allow me to 'drive' a Gnome or Fluxbox WM.

By drive I mean:
Switch Workspaces
Rotate through the window list (Alt-Tab)
Enter key strokes into a window
What I am trying to do is create a script to switch the display to show all of the workspaces and windows within them.

I know about 'chvt' but that is only part of the solution.

Under OS/2 there was a Rexx API that worked great, I think it was call APMT?

Any ideas?

David the H. 07-04-2008 02:24 PM

You might want to try xmacro. Documentation is sparse on it, but it's actually easy to use. Simply record your mouse and keyboard actions with

xmacrorec2 > macro.txt
(There's also xmacrorec (no number). I don't know what the difference is, but xmacrorec doesn't seem to handle mouse movements for some reason. Edit: xmacrorec appears to be for remote displays, while xmacrorec2 records the local one only.)

Then you can edit it as you wish and play it back with

cat macro.txt | xmacroplay -d 500 ":0.0"
the last number is your display number, and the -d is the number of milliseconds between commands. Set it too low and everything will fly through almost instantaneously. But setting it slower has the side-effect of making mouse double-clicking impossible. You can insert delays into the macro file itself instead if necessary.

All times are GMT -5. The time now is 01:14 AM.