Make a second mouse/keyboard (virtual) for xdotool to use

mousex11xorg

I have a script running a set of xdotool commands. It only uses half of my screen but I cannot use my keyboard or mouse while it is running due to the number of clicks and typing that is executed. Is there a way to set up a second keyboard/mouse for the xdotool to use without physically having 2 sets of keyboards/mouse?

I am using Fedora 20 with a Gnome Desktop Manager.

Best Answer

I don’t think this is possible, because there can always only be one window that receives input from mice and keyboards, i.e. one window that has the focus.

But you can run the program you want to automate in a separate X-server. So do

X :1 &
export DISPLAY=:1
myprogram &
xdotool …

This way you can also use the whole screen. The downside to this approach is, that you still can not see your usual desktop and the controlled one at the same time. So either start the xdotool commands from the new X-server and leave them running in the background, or use a tool called xpra. It allows you to run a new virtual X-server and connect to it from the default X-server. To set it up you run

xpra start :1
export DISPLAY=:1
myprogram &

and to view the program run

xpra attach

from another terminal in the original X-server.

Related Question