Share a Keyboard/Mouse Between Multiple Computers With x2x
If you have multiple computers on your desktop there are a number of scenarios for using them:
- The brute force way: get a big desk and a swivel chair and spin back and forth between keyboards/mice
- Use VNC or rdesktop to control secondary computers from your primary computer. The main problem with this is that you lose all the screen real estate on your secondary computers and end up with their desktops showing in a window on your primary computer.
- Get a KVM to allow you to switch one keyboard/mouse between multiple
computers.
The normal usage of a KVM is to switch your monitor as well as your keyboard and mouse, but that's not required. KVM's often seem like a great solution for many peripheral sharing problems, but they're a bit of a hit-or-miss. They often have switching problems, system boot problems, video quality problems, and if you use multiple monitors a KVM to switch multiple monitors between systems gets pretty expensive. - Use x2x, the solution we'll examine here, to share the keyboard and mouse between systems.
There are two ways to run x2x on Linux, the easiest is to use ssh with X forwarding enabled and ssh from the primary system to the secondary system and run x2x on the secondary system:
primary $ ssh -X secondary x2x -east -to :0
The -X option tells ssh to enable X forwarding. The "x2x ..." tells ssh to run x2x on the remote system (secondary) rather than running the shell. The "-east" option tells x2x where one system is relative to the other: to the east or west (-west).
The primary system is the system whose keyboard and mouse you are actually using. The secondary system is the one that is going to share the primary system's keyboard and mouse.
Now, if you move the mouse on the primary system over to the edge where the secondary system is the mouse pointer should move from the primary screen to the secondary screen and from now on any mouse movement should be passed to the secondary system and anything you type on the keyboard should be sent to the secondary system. If this doesn't work try moving the mouse to the other side of the screen, if that works then restart the command using "-west" rather than "-east".
The other method of running x2x on a Linux system is to run it directly on the primary system and tell it to connect to the X server on the secondary system:
primary $ x2x -to secondary:0.0 -east
The reason this is not the easy method is that you also need to enable remote X access on the secondary system using xhost:
secondary $ xhost primary
and you also need to open TCP port 6000 on both systems. The easiest way of doing this is going to depend on your distro.
The main advantage of the second method is that copy/paste will now work between systems.
Getting x2x to work on a Windoze system takes a bit more work, mostly because first you have to install Cygwin. Although, if you're a Linux fan you should already have it installed, it's the only way to make Windoze bearable. When you're installing Cygwin make sure x2x is selected in the list of available packages.
Using x2x with Cygwin has a couple of restrictions/problems:
- You can't use the ssh connection method.
- You have to use the Windoze system as the primary system (i.e. you have to use the keyboard and mouse on the Windoze system).
- If you have multiple displays on your Windoze system you'll probably experience mouse problems when you return the mouse from a secondary display. The only workaround is to move the mouse very very slowly when you're about to move off a secondary display onto the primary display.
When using x2x on Windoze run the following command from a shell prompt:
windoze $ x2x -fromwin -to secondary:0.0 -east
Generally speaking x2x works very well both on Linux and on Windoze. Every once in a while you may get a bit of mouse flakiness when you move a window on a secondary display. Also once in a while, when using the shift key you may get the unshifted character on the secondary system if you type too fast. But in most instances you won't notice any difference between typing/mousing on the primary system and on the secondary system.
p.s. If you have a problem where you get a ">" when you type "<" you need to find a newer version of x2x. This is long-standing bug that was recently fixed.
Mitch Frazier is an Associate Editor for Linux Journal.
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Designing Electronics with Linux | May 22, 2013 |
| Dynamic DNS—an Object Lesson in Problem Solving | May 21, 2013 |
| Using Salt Stack and Vagrant for Drupal Development | May 20, 2013 |
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
- seo services in india
3 hours 2 min ago - For KDE install kio-mtp
3 hours 3 min ago - Evernote is much more...
5 hours 3 min ago - Reply to comment | Linux Journal
13 hours 48 min ago - Dynamic DNS
14 hours 22 min ago - Reply to comment | Linux Journal
15 hours 21 min ago - Reply to comment | Linux Journal
16 hours 11 min ago - Not free anymore
20 hours 13 min ago - Great
1 day 46 sec ago - Reply to comment | Linux Journal
1 day 8 min ago
Enter to Win an Adafruit Pi Cobbler Breakout Kit for Raspberry Pi

It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Pi Cobbler Breakout Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- 5-21-13, Prototyping Pi Plate Kit: Philip Kirby
- Next winner announced on 5-27-13!
Featured Jobs
| Linux Systems Administrator | Houston and Austin, Texas | Host Gator |
| Senior Perl Developer | Austin, Texas | Host Gator |
| Technical Support Rep | Houston and Austin, Texas | Host Gator |
| UX Designer | Austin, Texas | Host Gator |
| Web & UI Developer (JavaScript & j Query) | Austin, Texas | Host Gator |
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?



Comments
Looks like we need another option.
I started using Synergy when I saw it mentioned on Tech-TV. I had Synergy working between WindowsXP, Linux (CentOS), and UNIX (IRIX). The nicest feature was cutting-and-pasting between the computers. BUT that was 2 jobs and 3 years ago.
The latest release of Synergy on Sourceforge was April 2006. Is the project dead or is it only a long time between releases? If the project is dead it's only a matter of time before obsolescence creeps in and Synergy is no longer useful.
I just checked and the latest Freshmeat release of x2x is from Sept. 2005. The page also says, "we are looking for brave person who can read and understand whole x2x and will write new x2x".
Looks like both projects are inactive. :-(
New Projects
The original Synergy is dead, but people have continued it. The Windoze project is Synergy+, and for Mac there's SynergyKM. SynergyKM is awesome, it integrates straight into your Mac System Preferences and is extremely easy to use.
So u folks don't have any
So u folks don't have any problems with synergy?
I have server on Windoze and client on Gentoo and for me it doesn't even work unless it's started under root privileges (the synergyc). And even then left-arrow and down-arrow are not automatically repeated (haven't noticed problems with other keys) on the client end. Which is a real pain in the ass if you are trying to code something longer than 15 lines.
But other than those two quirks - it works great and I love it.
keyboard setup
I use synergy between Fedora and XP - with a microsoft multimedia type keyboard. It took a bit of poking around but some of my issues were just getting the keyboard set up correctly for KDE. Once I did that everything worked great - even the volume keys - and other special keys to launch email, browser, etc. It really is the ultimate solution I've found for sharing keyboard and mouse.
It does run into issues sometimes, or can get bogged down if the machine running as the server comes under a really heavy load - but I would imagine this would be the case with any software doing the same type of thing. The ability to copy and paste between machines is so cool I can't even begin to think what it would be like not to have that.
SYNERGY is the way to go!
SYNERGY is the way to go!
Synergy
Synergy is a dead project. Last updated in 2006.
So? The source is available,
So? The source is available, it still compiles, and works flawlessly. Synergy rocks.
For those of you who need to
For those of you who need to share between a Mac running leopard & any other machine, use SynergyKM on the mac - it works beautifully and integrates into the control panel.
an alternative
A much easier way to share mouse and keyboard is by using synergy. It works fine on linux and on windoze too. If you want to get the connection secure you have to work with a ssh-tunnel. Copy/Paste between the 2 systems works as well.
synergy2.sourceforge.net
Or... use Synergy
x2x apparently works with X-windows only. A similar project, Synergy (http://synergy2.sourceforge.net/) works cross-platform with Windows, Linux, and MAC.
Synergy work very well even
Synergy work very well even between windows and linux http://synergy2.sourceforge.net/