QEMU Clipboard synchronization

A week ago I wrote that I hadn't been able to find any network clipboard applications that worked well in order to allow me to share the clipboard between the host and the QEMU guest OS. Yesterday I got a bright idea about how this can be done in a simple way with widely used and maintained tools.

x2x allows the keyboard, mouse on one X display to be used to control another X display. It also shares X clipboards between the displays. A similar program called x2vnc allows a host running X to control a host running a VNC server. The primary function of these two programs (controlling the other display) is not interesting in this context. However, the clipboard sharing of both of them works very well.

Guests running X

Before it is possible to let x2x connect to the X server on the guest, you need to forward a port with the -redir option to QEMU. Personally I use "-redir tcp:6042::6000" which will make QEMU listen on port 6042 and forward it to port 6000 in the guest.

X on the guest needs to be started with the -listen_tcp option in order to allow connections from the network. Furthermore you need to run "xhost +" to allow the host to connect to it.

When all this is taken care of it is just a question of running "x2x -to :42" on the host.

Guests running something else

When running a guest OS using something else than X (e.g. Windows), install a VNC server inside the guest OS and run QEMU with "-redir tcp:5900::5900".

You can then run "x2vnc" on the host.

E-mail Valid XHTML 1.1 Valid CSS!