Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 07-04-2008, 02:37 PM   #1
Registered: May 2006
Location: Mt Umunhum, CA, USA, Earth
Distribution: Debian/ Fedora/ Ubuntu/ Raspbian
Posts: 549

Rep: Reputation: 40
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?
Old 07-04-2008, 03:24 PM   #2
David the H.
Bash Guru
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian + kde 4 / 5
Posts: 6,834

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
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.

Last edited by David the H.; 07-04-2008 at 03:31 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Keyboard inputs same characters? yuxingpiao Linux - Hardware 0 06-12-2008 04:25 AM
Perl Keyboard Inputs opto Programming 2 08-28-2006 01:28 PM
Comparison: Enterprise Linux Vs. Solaris need feedback and inputs. savithk Linux - Enterprise 2 01-22-2006 02:38 PM
Simulated mouse clicks in linux? devilkin Programming 2 02-14-2005 08:59 AM
Booting Kernel with simulated root file-system priyankadeven Linux - Newbie 2 12-29-2004 07:47 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:23 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration