There is a pretty cool command-line based application that can execute keystrokes, mouse movement and mouse clicks, called Xautomation. It’s kinda useless if you are sitting at the computer with the terminal in the foreground. But it’s really awesome if you are coding an application that runs in the background and responds to signals from a remote control or similar. I have coded a little command-line based Python 3 program that does just that. It reads USB signals from my Arduino board which is connected to a IR receiver, and executes hotkeys that fits in Totem Media Player.
As an Arch Linux user it was a piece of cake to get Xautomation by downloading it from the AUR:
To use it, open a terminal and print:
xte --help
Then you will get a list of stuff that you can do with this piece of software, like:
xte "key a" xte "str aAa" xte "keydown Shift_L" "key a" "keyup Shift_L" xte "mousermove 100 100"
To execute these commands from a Python 3 application, use this code:
import subprocess subprocess.call(["xte", "key a"])
On my local library I stumbled over a really nice book called