8.14. Using VNC to Control Windows and Linux at the Same Time
Problem
You need to use a Windows PC and a Linux PC a lot. Sure, you get some exercise hopping back and forth from chair to chair, or scooting your chair about, but it would be nice to control both from a single keyboard and mouse, and you would rather not spend money on a hardware switch.
Solution
As usual, the Linux world provides an abundance of useful goodies. In addition to a Windows VNC server (see the previous recipe), you'll need the x2vnc program.
Of course, Linux must be in charge, and will control both computers. First, install x2vnc on Linux.
Make sure the Windows VNC server is running and accepting connections.
Then, fire up x2vnc:
$ x2vnc 192.168.1.28:0 -west
x2vnc: VNC server supports protocol version 3.7 (viewer 3.3)
Password:
x2vnc: VNC authentication succeeded
x2vnc: Desktop name "powerpc-w2k"
x2vnc: Connected to VNC server, using protocol version 3.3
x2vnc: VNC server default format:And there you are. -west
means left, so you can move your cursor to the left off the edge of
your Linux screen, and it will reappear on your Windows screen. Now,
you control both computers with the same keyboard and mouse.
Discussion
You'll notice that this is quite a bit peppier than a regular VNC session because you are running native sessions on each computer, rather than creating virtual graphics servers.
This can only be used to control Windows from Linux. If you want to run your primary session from a Windows PC, use Win2VNC ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access