Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I was wondering if there was an open source program that would allow me to have a certain keystroke/key combination pressed every say, two seconds or so. Forgive me, I merely do not know what a program like this would be called. Thanks!

share|improve this question
add comment

2 Answers

up vote 6 down vote accepted

Yes, there is an open source program to create fake keyboard and mouse inputs for GNU/Linux. It is called Xdotool Install Xdotool.

To press a key (in this exemple 'a') every two seconds you can use a script like this :

#!/bin/bash

while true; do
  xdotool key a
  sleep 2
done

If you make this script executable and you add it on Startup Applications it will press 'a' every two seconds.

Here is the documentation for Xdotool :

http://www.semicomplete.com/projects/xdotool/xdotool

And here is the specific part on keyboard commands :

http://www.semicomplete.com/projects/xdotool/xdotool#keyboard_commands

share|improve this answer
add comment

If you are using a Logitech keyboard, there is a package called "g15macro" in the Ubuntu repo that is useful. Otherwise there are other open source applications such as "xmacro" and "xnee".

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.