I sadly have to use this proprietary program that bundles a camera driver. I want to perform a specific action with it, which involves clicking a few buttons. And there is no CLI.

So, what is the easiest way to automate this? I though of using xvfb to open the program in a fake X environment, but then how would I go about performing input operations? It could be click pixel at (x, y), but it would be even nicer if I could reference buttons and menu items.

If there is a simpler way to do it, please tell! I'm not sure xvfb is the correct method. I don't even know the actual name of what I'm trying to accomplish, so searching is very hard...


Use xdotool which can fake keyboard/mouse input, window management, and more.

Sample usage based on the install_mt4-xdot.sh script which installs Windows app under wine:

wine setup.exe &
echo "Waiting to initialize..."
while ! WID=$(xdotool search --name "Setup"); do
  sleep 2

echo "Sending installer keystrokes..." >&2
xdotool key --window $WID --delay 500 space Tab Tab Tab Return Tab Tab Tab space Alt+n

echo "Waiting for installer to finish..." >&2
xwininfo -id $WID -tree
while pgrep -l setup; do sleep 5; done

echo "Waiting program to start..." >&2
while ! WID=$(xdotool search --name "Title - *"); do
  sleep 2

echo "Closing application..." >&2
xdotool key --window $WID --delay 500 Escape Escape Alt+f x
sleep 1
wineserver -k
echo "Installation successful." >&2

Using xdotool you can control any app or window.

However if it's wine app only ran under Xvfb, you can also consider using winetricks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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