A dual-screen hack
Written by Fredrik Hubinette
Based on ideas from x2x and code from VNC.
What it does
This program will let you use two screens on two different computers
as if they were connected to the same computer. Even if one of the computers
runs Windows 95/98/NT and the other one runs X-windows. If they
are both running Windows, you probably want to use Win2VNC
Personally, I have
two computers, both with linux installed, but I often have to run Windows 95
or Windows NT when working, and I just got tired of switching between the
two keyboards. Therefore I wrote this program. While running this program
I can move the mouse pointer beyond the right edge of my X display, and then
the pointer will appear on the screen on the other computer. If you have ever
used x2x or a computer with two graphics cards, you know what I am talking
How it works
The program will open a small (one pixel wide) window on the edge of your
screen. Moving the pointer into this window will trigger the program to
take over your mouse and send mouse movements and keystrokes though the
RFB protocol to a VNC server running on another machine. When the pointer
is moved back towards the opposite edge on the other screen, the mouse is
then released again.
The operation itself is almost identical to
x2x, but most of
the code was actually borrowed from the program vncviewer.
As the name x2vnc implies, x2vnc can only send events from an X-windows
based display to any VNC server. VNC servers can run on Microsoft Windows 95/98/NT/2000/XP. x2vnc will not run without X-windows. Please note that the
normal VNC server for X windows does not control the mouse
on the screen itself, but creates a virtual server in memory instead.
If you wish to control an X11 display with x2vnc, you need to use x11vnc,
but it's probably easier to just use x2x instead.
- x2vnc version 1.7.2
- You also need a VNC server to run
on the machine you wish to control, such as
- If you have any problems, try version
Changes since version 1.7.1
Changes since version 1.6.1
Changes since version 1.6
- Now re-connects automatically
- New input capture method which handles odd screen sizes better
- Added -tunnel and -via for automatic SSH tunneling
- Further fixes for cut'n'paste. (Should now work with java and on 64 bit platforms.)
- Randr support allow x2vnc to detect when the screen is rotated
Changes since version 1.5.1
- Added Martin Dorey's patch which fixes cut'n'paste
for Java (and other) applications.
- Fixed a bug in -navhack
Changes since version 1.4
- Added some patches from Grant McDorman to allow proper
cut'n'paste between x2vnc and Konsole/gnome-terminal.
- Honor $DESTDIR to make packaging easier.
- Added a workaround to make cut'n'paste work better with
old VNC servers.
- Since all new VNC servers already support wheel emulation
themseleves, x2vnc doesn't translate wheel events to arrow
up/down anymore unless -wheelhack is specified.
- Added -navhack which is similar to -wheelhack, except it
translates button 6 & 7 to Alt+Left/Right.
- Added -debug to debug key events
- Allow -edgewidth 0 to turn off edge-flipping
- Now traps grabkey errors, no more X errors.
- Xinerama support, allows x2vnc to work
sanely on multi-head X displays.
- If stdin is not a tty, read password with
fgets() instead of getpass(). This allows
scripts to feed in the password.
- New arguments -noblank and -lockdelay allows you
to keep screen savers from activating while using
Changes since version 1.31
- Added hotkey functionality.
- Added Macintosh mode.
- Included a patch for -trimsel.
- Implemented -scrollines
- Fixed a glitch which made the pointer appear briefly
at the wrong side of the screen.
- Implemented a grab timeout to allow xscreensaver to activate
- Added -desktop option.
- AltGr should now work properly.
- move remote cursor to resting place
immediately when connecting to confuse the user less.
(Thanks to Patrick Cheng)
- Included tkx2vnc, a x2vnc frontend written by David Noble
(In contrib directory)
Changes since version 1.3
- Fixed an off-by-one error that made it impossible to
get to the last pixel on the screen with the mouse pointer.
This of course made it hard to access the Task Bar on the
Changes since version 1.2
- Cut'n'paste should now work properly
- Reversed the mouse wheel direction. (Use -reversewheel for
- Added a autoconf 'configure' script to make it easier to compile
- Fixed some -edgewidth problems
Changes since version 1.1
Changes since version 1.0
- SHIFT-TAB should now work on HP-UX
- Applied the mouse-wheel patch, can be disabled with -nowheel
(and fixed a bug in the mouse-wheel patch)
- Added a man page
- Made -passwd create the password file if it does not exist
- Added makefile rules for making rpms
- SHIFT-TAB should now work
- Should now work with xlock and other evil X programs.
- new option -edgewidth should make it work on
Digital Unix X servers.
- When mouse leaves Win32 machine, it parks the mouse pointer
on that machine in a place where you can hardly see it.
- Applied a patch from Grant McDorman that should make x2vnc
work with multiple-screen X servers.
- Fixed a bug which made x2vnc not work with certain window
managers. (Like enlightenment) Thanks to Brad Fitzpatrick for
helping me with this one.
- "xmkmf ; make" should now work.
Basically, you just run: x2vnc [options] host:display.
Where [options] are:
- The X windows display to connect from.
- Allow multiple
connections to the same VNC server.
- -north , -south , -east , -west ,
which edge leads to the other screen.
- -passwdfile password-file
this option you can start x2vnc without entering a password. The file is
created by vncpasswd which comes with the X-windows VNC software. If the
file does not exist, x2vnc will ask for a password and create the file.
- This option will cause the trigger window to re-surface automatically
if it is covered up by another window.
- -hotkey key
- This option allows
you to select which key to use to warp the pointer to and from second
computer. The default is "Control-F12", any combination of modifiers can
be used, such as "shift-alt-meta-ctrl-F1" (or s-a-m-c-F1).
- -edgewidth pixels
- This is a workaround for some X servers which do not allow the mouse to
go all the way to the edge of the screen. By setting this to 2 or greater,
the mouse will be able to reach the x2vnc window and thus warp to the
windows machine. The default value is 1.
- -desktop desktop-number
- With this
option, you can make x2vnc non-sticky. This may not work with all window-managers.
Note that the first desktop is usually 0 (zero). If you want x2vnc to appear
on the last (rightmost) desktop, use -1. This option was especially created
with the sawfish edgeflipping in mind, normally you would use "-west -desktop
0" or "-east -destkop -1" with Sawfish to allow edgeflipping to work normally.
- -timeout seconds
- This options tells x2vnc how long to wait before warping
the cursor back to the X screen if there is no activity. The reason for
this is that some screen savers, such as xscreensaver, cannot activate
while x2vnc is in control of the cursor. The default value is 590 seconds,
which is equivalent to 9 minutes and 50 seconds. Using a value of 0 will
disable timeouts completely.
- Disable mouse wheel emulation. Without
this option your wheel will work like arrow up/down, with this option
x2vnc will send them as mouse-button 4/5.
- Invert the up/down
direction of the mouse wheel emulation.
- -scrolllines lines
- When using
mouse wheel emulation, this selects how many up/down events will be sent
for each tick of the mouse wheel.
- Macintosh specific mode, maps second
mouse button to control-mouseclick.
- If the X selection looks like
a URL, trim leading and trailing spaces. This can be useful for pasting
URLs into a browser.
- Prevent screen blanking on the remote desktop while
you are working on the local desktop. Requires the
MIT-SCREEN-SAVER or XIDLE extension to work properly.
If neither of these extensions are present,
the remote desktop will always be kept from blanking.
- -lockdelay seconds
- This is only meaningful when using the -noblank
option. When this option is present. With this
option, x2vnc will not attempt to wake up the
remote screen if you have been idle for more than
the specified amount of time. This is useful if you
need a password to unlock the remote screen and
would rather leave it blanked until you need it.
Some of these options are the same as for the vncviewer that the code came
from, so more information can be found at the VNC site.
If you want to run x2vnc between two X displays, you need to install
the slave machine, or use
If you want to run x2vnc between two Microsoft Windows machines, then
you need to install an X server such as eXceed on one of the Windows
machines, and compile x2vnc for windows or use Win2VNC instead. Good luck.
If you have a problem with cut'n'paste from the VNC server to the X
screen, I recommend using the 3.x version of the VNC server as there
are still some outstanding bugs with the 4.x version.
Problems? Questions? Suggestions? Check out the online forum.
This page has been accessed 376,698 times since
- Design by