x2x(1) | General Commands Manual | x2x(1) |
x2x - X to X connection
x2x <[-to <DISPLAY>] | [-fromwin | -from <DISPLAY>]> [options...]
x2x allows the keyboard and mouse on one ("from") X display to be used to control another ("to") X display. Since x2x uses the XTEST extension, the "to" X display must support XTEST.
If x2x is built under Cygwin (on Windows XP or Windows 2000) then the -fromwin option may be specified to allow the "from" display to be the Windows desktop. (The Cygwin build also supports use of an X display for the "from" screen). Use of -fromwin sets the default behaviour as if the -big -west -capslockhack options had also been given.
In the default interface, x2x puts a window on the "from" display. This window is labeled with the name of the "to" display. Keystrokes typed into this window go to the window on the "to" display that has the input focus. Clicking on the x2x window causes the mouse on the "from" display to control the cursor on the "to" display. Performing a subsequent multiple button click on the "to" display returns control to the "from" display.
If the -fromwin, -north, -south, -east or -west options are specified on the command line, x2x starts up with a different interface. When the mouse moves to the top, bottom, east side or west side of the default screen on the "from" display, the cursor slides over to the "to" display. When the mouse returns to to side of the "to" display that it entered, it slides back onto the "from" display.
Unless the -nosel option is specified, x2x relays X selections from one display to the other. (If -fromwin is specified then the X selection is relayed to and from the Windows clipboard as text strings).
Here are a few hints for eXcursion users (based on Intel version 2.1.309). First, use the -big option. Second, in the control panel, under mouse, check the box that enables "Automatically Capture Text on Button Up." X selections will then automatically move into the Windows clipboard. As is the case with all X applications running on 2.1.309 (including x2x), you will need to do an extra mouse click after performing the X selection for this operation to work. x2x is known to work poorly with eXcursion running on Windows 95, probably due to the Windows 95 task scheduler. x2x does work well with eXcursion running on Windows NT.
The hints for eXcursion are also valid for Exceed, with the exception that X selections work better, as long as you are using x2x version 1.25 or later.
Either the -to option or the -from option (or both) must be specified.
The -fromwin option works best when Windows is configured for focus-follows-mouse also known as X Mouse. This can be set using TweakUI for Windows XP (on the Mouse/X-Mouse panel) or the XMouse2000 program for Windows 2000. If Windows is set for its default behaviour x2x will attempt to get the keyboard and mouse focus but may not succeed. (The Windows XP TweakUI has a General/Focus option that can be unchecked to allow applications to steal the focus.) If it fails the first try, x2x tries quite hard to get the focus!
If the "to" display supports mouse buttons 4 and 5 then mouse wheel events on the Windows side are translated to clicks of buttons 4 and 5 on the X display. This matches with XFree86 servers using Option "ZAxisMapping" "4 5".
A link may be created on the Windows desktop to conveniently launch x2x. Assuming cygwin is installed to C:\cygwin and x2x.exe is in /usr/X11R6/bin then the link properties should be set to:
Target:
C:\cygwin\usr\X11R6\bin\run.exe /usr/X11R6/bin/x2x -fromwin -to somewhere:0.0 -east
Start In: C:\cygwin\usr\X11R6\bin
The "Start In" option is important to allow DLLs to be loaded and C:\cygwin\bin must be on the Windows PATH to allow other DLLs to be loaded. (If either of these are incorrect, launching the application tends to silently fail.)
There are two magic key combinations activated by -fromwin:
RightAlt-Home: Forces the focus back to Windows without needing the mouse to be moved. Useful when some popup window on the Windows side grabs the mouse!
RightAlt-End: Exit x2x
Once upon a time, the trigger window was a regular window and could be arbitrarily stacked. If obscured it would stop working. Later the trigger window became a dock, to be treated specially by the window manager. The EWMH spec suggests placing docks over all other windows... but some window managers place docks below before unmapping them. XMonad is one such window manager. In this case we would like to advertise struts - reserved space along screen edges that is not normally obscured. However this should not happen if the dock is already above all windows. And thus the new '-struts' settings is born, which uses the '_NET_WM_STRUT' property.
Note that this is a less hacky alternative to '-resurface'.
Calling the system whose keyboard is to be used "primary" and the other system "secondary", you need to specify either -from primary-x-display or -to secondary-x-display. The x2x program can be run on either system. The easiest way to maintain security is to tunnel an X connection over ssh. Since x2x can be run on either computer, it can be invoked in either of the following ways, where we assume the local display on each system is :0.
The left monitor covers (0,50,300,350) of the virtual total resolution while the right monitor covers (300,0,700,400). The four numbers each represent left, top, right, and bottom. Also, you have two dead spaces: (0,0,300,50) and (0,350,300,400). Thus, the complete square region for this configuration would be (0,50,700,350).
If no explicit description is provided, the x2x recognizes the virtual total resolution (0,0,700,400) only. As a consequence, the dead space region cannot be reached in the secondary system. You can solve this problem by teaching x2x that the real complete square region for the secondary system (0,50,700,350) using the -comptereregion(left|up|right|low) options as below:
The synergy program ⟨URL: http://synergy-project.org ⟩ has similar functionality to that of x2x, supports multiple platforms, and when I try to use it my X session crashes.
There is a nice Linux Journal article on x2x ⟨URL: http://www.linuxjournal.com/content/share-keyboardmouse-between-multiple-computers-x2x ⟩.
David Chaiken <chaiken@pa.dec.com>
Mark Hayter (-fromwin code, thanks to the WinVNC sources)
Addition of -north and -south options by Charles Briscoe-Smith
<cpbs@debian.org>.
Current maintaner is Mikhail Gusarov <dottedmag@dottedmag.net>
This software is experimental! Heaven help you if your network connection should go down. Caveat hacker. TANSTAAFL.
The x2x repository and issue tracker ⟨URL: http://github.com/dottedmag/x2x ⟩ has moved to github.
When using the -fromwin option if the Ctrl-Alt-Del keysequence is used while the mouse is forwarded to the X display then the Ctrl and Alt key press events are reported to x2x and forwarded but no other key events are generated. Thus if the Ctrl-Alt-Del sequence is used to manually lock the Windows display when the display is unlocked the mouse will still be forwarded to the X screen and the X server will believe Ctrl and Alt are still pressed. Pressing and releasing Ctrl and Alt should restore correct operation, as should returning the mouse to the Windows display (or using the RightAlt-Home magic key sequence).
If you have trouble with some keys not working, try setting the keymaps on both systems to be the same using setxkbmap. If that's not enough, make sure that the output of setxkbmap -query is identical on both machines.
Copyright (c) 1997 Digital Equipment Corporation. All rights reserved.
By downloading, installing, using, modifying or distributing this software, you agree to the following:
1. CONDITIONS. Subject to the following conditions, you may download, install, use, modify and distribute this software in source and binary forms:
a) Any source code, binary code and associated documentation (including the online manual) used, modified or distributed must reproduce and retain the above copyright notice, this list of conditions and the following disclaimer.
b) No right is granted to use any trade name, trademark or logo of Digital Equipment Corporation. Neither the "Digital Equipment Corporation" name nor any trademark or logo of Digital Equipment Corporation may be used to endorse or promote products derived from this software without the prior written permission of Digital Equipment Corporation.
2. DISCLAIMER. THIS SOFTWARE IS PROVIDED BY DIGITAL "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.IN NO EVENT SHALL DIGITAL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Windows 95 and Windows NT are trademarks of Microsoft Corporation.
Exceed is a trademark of Hummingbird Communications Ltd.