1 keyboard, 1 mouse, and several machines

You have 2 screens connected to the same machine, or several computers under different OS.

In this post, I present to you methods to make the most of your machines with 1 keyboard and 1 mouse.

In other words: switch the mouse / keyboard from your linux PC to the laptop under MS Windows or MACosX, and this in a natural way without special handling.

Any self-respecting computer scientist or geek has at least 2 computers at home, or at least 2 screens connected to his machine. There are therefore also at least 2 keyboards and 2 mice lying around on the same desk and it is immediately less fun to switch from one keyboard to another (when you’re not mistaken) and from one mouse to another. the other.

The solutions exist

  • Install a “Switch KVM” (Keyboard, Video, Mouse), a small box on which you connect 1 keyboard and 1 mouse, and which you connect to all your other machines.
  • Problems: you must physically connect all machines (graphics cards, keyboard / mouse output) to the box, and press a button to switch from one machine to another, and pay!
  • Pros: It works with all systems and no software installation is required.
  • Use 1 single screen / keyboard / mouse and take control of other machines in console mode, or in graphical mode with a PcAnywhere / VNC / Remote X Session (Unix / Linux)
  • Problems: It’s not practical, you keep 1 screen and lose usable surface.
  • Advantages: It works with all systems. / free tools exist

3rd solution, use all the screens, with a single keyboard, a single mouse, to form a single large virtual screen.

In fact to move from one screen to another, it will suffice to drag the mouse towards the edge in the direction of the next screen, and when it disappears from one screen it appears on the other screen, creating the illusion that you have moved the mouse to the other screen (the keyboard is active on the screen where the mouse is, ditto for? the clipboard! and this from one OS to another!)

You arrange the screens however you want.

The tools exist and they are all free

  • Synergie, the most complete, allows you to share your mouse / keyboard / clipboard between several machines (Windows / Linux / Unix) and MAC (even combined).
  • x2x is limited to X servers, therefore, linux / unix / macOsx and windows (if you install an x ​​server on it).
  • x2vnc can be used when the keyboard and the mouse are on a computer under X server, and the other machines under any OS, this software uses the RFB protocol of VNC to communicate with the other computers.
  • win2vnc is made for the user who has his keyboard / mouse plugged into a Windows machine, the OS of other machines does not matter.

All these tools work the same

  • (for windows) a VNC server must be installed on the slave machines. (for linux / unix / mac) you must authorize connections from the master machine. (a simple command like: $ xhost + masterMachine)
  • On the Master machine (the one on which the keyboard and mouse are installed) we launch x2x, x2vnc, win2vnc or Synergie (depending on its configuration). We declare that the machine slave1 is to the left of the master screen, that exclave2 is to the right, down or up in relation to the master, and so on.
  • Use your mouse to move from one screen to another.

Technical explanations

When you have started the tool by indicating to it that for example, slave machine 2 is to the right of the master screen, the tool will create a window (invisible) 1 pixel wide and taking the full height of your screen , when the mouse passes over it, hop! it sends the focus to the other screen (in fact it only sends the codes of the keyboard keys and the coordinates of the mouse.).

The negative point that can be found in the system is security: the information passes through the network (in the case of several machines) and in clear (RFB or Xwindow protocol).

The solution under linux / unix is ​​to create an SSH tunnel between master and slave.

Note that you can use this system locally if you have 2 or 3 screens connected to the same PC! (Xinerama mode allows you this … but not if you have one X server per graphics card. (Xinerama = one logical server on several graphics cards).

It’s simple, stupid limit, but it’s excellent and extremely practical.


IT software and Security Engineer, Open source enthusiast.

Paris, France http://ofdp.org