x2x(1)
x2x(1) β the X-to-X connection thing π«
okay bestie, welcome to the manual page for x2x, and no this is not a typo, it's genuinely pronounced "X to X" and it's giving cross-display main character energy π«Ά
β¨ NAME β¨
x2x β X to X connection. that's it. that's the name. short, sweet, iconic. π
π SYNTAX π
x2x <[-to <DISPLAY>] | [-fromwin | -from <DISPLAY>]> [options...]
like, you need one of those, okay? you can't just vibe in with nothing. the angle brackets said what they said. π
πΈ DESCRIPTION πΈ
so here's the whole thing: x2x lets you take the keyboard and mouse from one X display β we call that one the "from" display β and use them to control a totally different X display β we call that one the "to" display. two computers, one mouse, no chaos. well. some chaos. π¦
and because x2x is built on the XTEST extension, your "to" X display has to support XTEST. that's non-negotiable, bestie. if it doesn't, this whole thing does not work, periodt.
π§ the Cygwin situation (iykyk)
if x2x was built under Cygwin (on Windows XP or Windows 2000), then you can pass the -fromwin option and your "from" display gets to be the literal Windows desktop. yes really. the Cygwin build also supports using an X display as the "from" screen, so you've got options π
and here's the little sneaky bit: using -fromwin quietly sets the default behaviour as if you had also passed -big, -west and -capslockhack. so those three are just... on. surprise! π
πͺ the default interface (window girlies, this one's for you)
in the default interface, x2x puts a window on the "from" display, and that window is labeled with the name of the "to" display. so you always know where you're pointing. so thoughtful. π₯Ή
here's how it flows:
- keystrokes you type into that window go to the window on the "to" display that currently has the input focus
- clicking on the
x2xwindow makes the mouse on the "from" display control the cursor on the "to" display - then, doing a subsequent multiple button click on the "to" display hands control right back to the "from" display
so it's like a little mouse relay race. adorable. honestly. π₯
π the slidey interface (a.k.a. when you pass certain flags)
the moment you specify -fromwin, -north, -south, -east or -west on the command line, x2x starts up with a different interface. completely different vibe. β¨
in this mode, when your mouse moves to the top, bottom, east side or west side of the default screen on the "from" display, the cursor just slides over to the "to" display. like it's crossing a little invisible bridge π«Ά
and when the mouse comes back to the side of the "to" display that it entered from, it slides right back onto the "from" display. in through the door, out through the same door. polite. π
π selections, clipboard, the whole deal
unless you pass -nosel, x2x relays X selections from one display to the other. copying and pasting across machines, we love to see it. π
and if -fromwin is specified, the X selection gets relayed to and from the Windows clipboard as text strings. so. text only. keep that in mind. π
π eXcursion hints (yes this section is a whole era)
here are a few hints for eXcursion users, based on Intel version 2.1.309. buckle up:
- first thing β use the
-bigoption. - second thing β in the control panel, under mouse, check the box that enables "Automatically Capture Text on Button Up." once you do that, X selections will automatically move into the Windows clipboard.
and like every single X application running on 2.1.309 (yes, x2x included), you'll need to do an extra mouse click after performing the X selection for this operation to actually work. one more click. it's just how it is. π
also, real talk: x2x is known to work poorly with eXcursion running on Windows 95, probably because of the Windows 95 task scheduler being... itself. but x2x does work well with eXcursion running on Windows NT. so there's your fix: NT. β
π and for the Exceed girlies
the hints for eXcursion are also valid for Exceed, with one exception: X selections work better, as long as you're running x2x version 1.25 or later. newer version, better selections. that's the whole tip. π
part 1 of 3, keep scrolling bestie, we're not done π
β¨ OPTIONS β¨ π
Important, bestie: Either the-tooption or the-fromoption (or both) must be specified. No cap. π
-todisplay β Indicates the ("to") display that is remotely controlled by the "from" display. Default is equivalent to the default display. π-fromdisplay β Indicates the ("from") display that remotely controls the "to" display. Default is equivalent to the default display. β¨-fromwinβ Available when x2x is built in the Cygwin environment. This option indicates the ("from") display should be the Windows desktop. In this case the "to" display must be specified with the-tooption. Setting this option forces-bigand sets the default to-west-capslockhack.
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 πͺ
-northβ Slide off the north side of the "to" display onto the "from" display. βοΈ-southβ Slide off the south side of the "to" display onto the "from" display. π΄-eastβ Slide off the east side of the "to" display onto the "from" display. π-westβ Slide off the west side of the "to" display onto the "from" display. π-fontfontname β The font used in the x2x window. (Overridden by-eastor-west.) π€-geometryspecification β The X geometry specification for the x2x window. (Overridden by-north,-south,-eastor-west.) π-waitβ Tells x2x to poll the "to" and "from" displays at startup until they are ready. Useful for login scripts. β³-bigβ Workaround for a bug in the cursor grab implementations of at least one X server. Put a big window over the "from" display in order to force the X server to track the cursor. (This option is forced by the-fromwinoption). π-buttonblockβ If this option is enabled with-north,-south,-eastor-west, the cursor will not slide back onto the "from" display when one or more mouse buttons are pressed. π«π±οΈ-buttonmapbutton# "KeySym ..." β Map a mouse button to one or more keyboard events on the "to" display. This is useful if you have a mouse with more buttons than the remote X server can handle (e.g. a wheel mouse on a PC, merged with a Sun/Sparc OpenWindows display). πΊοΈ-nomouseβ Don't capture the mouse. (Overridden by-north,-south,-eastor-west.) π ββοΈ-nopointermapβ Since x2x uses XTEST, which sends input at a lower level than the pointer button mapping, x2x needs to understand the "to" display's button mapping and do appropriate conversion. Use this option to turn off the pointer button conversion. π-noselβ Don't relay the X selection between displays. π-noautoupβ Normally, the autoup feature in x2x automatically lifts up all keys and mouse buttons when it removes the cursor from the "from" display. Note: the autoup feature changes the state of lock functions like Caps Lock. The state of the lock function may not correspond to the state of the keyboard LEDs! To disable this feature, use the-noautoupcommand line option. π¨-resurfaceβ Ugly hack to work-around window manager ugliness. The-north,-south,-eastand-westmodes actually put a small window on the side of the "from" display. This option causes this window to resurface itself if another window ever obscures it. This option can cause really nasty behavior if another application tries to do the same thing. Useful for login scripts. π§ββοΈ-win-outputβ Makes the small window ("trigger window") on the side of the "from" display an InputOutput window instead of an InputOnly window. Visibility notification events are never generated for InputOnly window, therefore-resurfacewould not work for InputOnly window. Use-win-outputtogether with-resurface. πͺ-win-transparentβ Makes the small window ("trigger window") transparent. Use with-win-outputoption. π»-strutsβ Advertise struts in_NET_WM_STRUT
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. ποΈ
-capslockhackβ Ugly hack to work-around the situation in which the "to" Xserver doesn't seem to honor the state of the CapsLock on the "from" Xserver. This is the default when the-fromwinoption is given (although the hack used is slightly less ugly). π-nocapslockhackβ Disable the-capslockhackbehaviour. Used to change the default behaviour after the-fromwinoption is specified. π‘-clipcheckβ Check that clipboard entries are regular strings (XA_STRING) before forwarding to Windows. Enabling this is safer but may prevent copying with certain setups (eg from emacs under KDE/XFree). π-shadowdisplay β Also sends mouse movements and keystrokes to this display. Useful for demos. Amaze your friends: specify multiple shadows. π-stickysticky-key β This option is primarily for "lock" keys likeCaps_Lock. If a lock key only seems to work on every other press, try this option. The sticky option prevents autoup for the specified key. Look in/usr/include/X11/keysymdef.hfor a list of valid names of keys (remove the leadingXK_). π©Ή-singlestickyβ Some X servers generate both a key down and a key up when a lock key is toggled. Some X servers generate a key down when a lock key is activated and a key up only when it is deactivated. This option will allow an X server with the former behavior to control one with the latter behavior. Use this ifCaps_Locklock is behaving like shift. π-labellabel β Override the label of the control window (useful when running over ssh). The label is the text displayed within the control window. π·οΈ-titletitle β Override the title of the control window (useful when running over ssh). π-copyrightβ Prints the full copyright for the x2x code. Β©οΈ-noscaleβ This option turns off the mouse scaling. In some circumstances, the remote screen is so different in physical size or resolution that the normal mouse scaling applied by x2x distorts the mouse movement so much as to be practially unusable. Note: this is only useful if the remote screen is lower resolution than the local screen and also causes the remote mouse pointer to warp around when it hits the edges. π-completeregionleftβ Describes leftmost coordinate of complete rectangle region in from-display. If from-display is configured with multiple monitors and they have different resolution, few regions that does not belongs to any monitor becomes dead space that mouse cannot move in. In the case, the dead space can be mapped to legal region of to-display. If complete region in from-display is specified, X2X maps only complete region to to-display and avoid the dead, but legal regions. β¬ οΈ-completeregionrightβ Describes rightmost coordinate of complete rectangle region in from-display. β‘οΈ-completeregionupβ Describes uppermost coordinate of complete rectangle region in from-display. β¬οΈ-completeregionlowβ Describes lowermost coordinate of complete rectangle region in from-display. β¬οΈ
run indirectly on secondary
primary $ ssh -X secondary x2x -to :0 -east
run indirectly on primary
secondary $ ssh -X primary x2x -from :0 -west
run directly indirectly on primary
primary $ ssh -A secondary env DISPLAY=:0.0 ssh -X primary x2x -from :0 -east
okay so now the multi-monitor saga, because this is where it gets juicy π¦
If your primary display is configured with several monitors having different resolutions, the -completeregion(left|up|right|low) options can be helpful. Suppose that you have two monitors connected to the primary system and the resolution of the left-side monitor is 300x300 while the right-side one is 400x400. Also, you aligned these two monitors to be vertically centric. Therefore, your primary system has virtually 700x400 resolution.
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:
-completeregionleft 0 -completeregionup 50 -completeregionright 700 -completeregionlow 350
π SEE ALSO π
The synergy program β¨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. <em>(not me throwing shade at synergy, the manpage said it first π)</em>
There is a nice Linux Journal article on x2x β¨http://www.linuxjournal.com/content/share-keyboardmouse-between-multiple-computers-x2xβ©. π«Ά
π AUTHOR π
- David Chaiken
<chaiken@pa.dec.com> - Mark Hayter (
-fromwincode, thanks to the WinVNC sources) - Addition of
-northand-southoptions by Charles Briscoe-Smith<cpbs@debian.org> - Current maintaner is Mikhail Gusarov
<dottedmag@dottedmag.net>
shoutout to the whole squad fr, legends only π
π BUGS π
This software is experimental! Heaven help you if your network connection should go down. Caveat hacker. TANSTAAFL.
lowkey a warning that hits different β it's giving "we told you so" energy. π
The x2x repository and issue tracker β¨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). β¨ magic key sequence β¨ we love a fix
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. iykyk π§
π LAWYERESE π
okay bestie, putting on my serious hat for a sec, this part is real and you can't skip it π
Copyright (c) 1997 Digital Equipment Corporation. All rights reserved.
By downloading, installing, using, modifying or distributing this software, you agree to the following:
- 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.
- 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.
and that's the whole page bestie!! πΈ the footer on this one is just the man page tag x2x(1) β no version number, no date, that's literally all it says, iconic minimalist behaviour tbh. π go forth and share your keyboard, you absolute main character πβ¨
π¦ where this page comes from
- alpine 3.24: x2x-doc 0.0.0_git20210925-r0 Β· MIT
- debian bookworm: x2x 1.30-10+b1
- debian trixie: x2x 1.30-12
- nixos 26.05: x2x 1.30-unstable-2025-02-17
- nixpkgs unstable: x2x 1.30-unstable-2025-02-17
- ubuntu jammy: x2x 1.30-10
- ubuntu noble: x2x 1.30-11
- ubuntu questing: x2x 1.30-12
- ubuntu resolute: x2x 1.30-12build1
- ubuntu stonking: x2x 1.30-12build1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms