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.
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.
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 on Windows, and the VNC server of your choice on Linux .
Running two Linux PCs requires x11vnc for the VNC server.
x2vnc works by creating a one-pixel-wide trigger window at the edge of the screen, which causes x2vnc to take control and send mouse movements and keystrokes to the Windows PC.
Here are some useful options:
-resurface
This keeps the trigger window on top, so it can't be covered by another window.
-edgewidth 3
If you have problems with the trigger window, you can try making it wider. Setting it to 0 disables it entirely, if you would rather use the hotkey to switch back and forth.
-debug
If you are having problems, crank up the verbosity.
-hotkey
A common error message is "Warning: Failed to bind x2vnc
hotkey, hotkey disabled." Use the -hotkey
option to specify which hotkey
you want, like this:
$ x2vnc -hotkey F12 192.168.1.28:0 -west
Hitting F12 switches the cursor back and forth between your two screens. The default is Ctrl-F12; you may use any combination of meta keys that you like.