One mouse and keyboard to rule them all

Chandan Singh
8 min readJul 3, 2021

--

Goal

Control your computers with one mouse and keyboard so that you can use your favorite keyboard and mouse across multiple computers.

Problem

WFH (work from home) is a norm these days due to the pandemic situation. If you are a developer, there is a high possibility that you are using multiple computers for your work.

You need to switch from one computer to another. It’s a hassle to shift from one set of keyboard and mouse/touchpad to another.

Solutions

These are:

  1. Hardware KVM switches: These switches provide hardware interfaces for connecting one and mouse and keyboard with multiple computers. The main problem with this option is to have separate hardware and wires + purchase of a KVM switch. One benefit, it works in most of the scenarios https://en.wikipedia.org/wiki/KVM_switch. ❌
  2. VNC or Remote Desktop: It can work for you but you need to run separate VNC/RDC sessions for each of the machines that you want to access. ❌
  3. Software KM switches: There are many software applications that provide similar functionalities and they have their own limitations. it requires the installation of a software application on all the computers where the keyboard and mouse to be shared. If the security of computers is a primary concern or, if you don’t have permission to install new applications then it may not be the right solution. ✅ ❤️

KM: Keyboard and Mouse

KVM: Keyboard, Video, and Mouse

We will look into one of the free open-source software switches called Barrier which will enable us to use the same keyboard and mouse across all the computers.

Why Barrier? Let’s compare:

Comparison of Softwares. Barrier is free and supported on Windows, Mac and Linux operating systems

I wanted to use my Keyboard and Mouse across 3 different platforms: Windows, macOS, and Ubuntu (Linux). That means the right fit for my requirement was either Barrier or Synergy. Since Barrier was free, it was naturally my first choice.

Minimal Setup Requirements

  • Computers on the same local network (home/office wifi/LAN)
  • Permission to download and install new applications on the computers
  • Internet access
  • Cost $0.00

Time needed

Less than 30 minutes

Required Skills

  • Install the software and change the configurations

Barrier — Setup

Barrier application only works with computers running on the same local network. The main reason is, one computer works as a Server and other computers work as a Client that connects with the Server over the network.

The computer which connects with Keyboard and Mouse need to be the Server. To set up the Barrier Server and Clients, we need to download the Barrier application.

⬇️ You can download the Barrier application from the Assets section of the releases page: https://github.com/debauchee/barrier/releases

Download the platform-specific Barrier application on each computer.

Barrier Installation

macOS

  • In my case, I wanted to use my MacBook Pro as the main computer so that I can share its keyboard and touchpad (or, Mouse) with other computers.
  • For MacBook Pro (or, macOS), download the .dmg file. Open the Barrier-x.x.x-release.dmg file. Drag-and-drop Barrier application to the Applications folder.
  • Perform installation if required.

If you receive the error, grant the permission to open it anyway. Go to System Preferences > Security & Privacy > Allow apps Downloaded from: “Barrier” was blocked from use because it is not from an identified developer.

When you click on the button “Open Anyway”, you may see the Accessibility Access dialog. Provide Accessibility permissions to the Barrier application.

Ubuntu (Linux)

  • Run the following command on the terminal
sudo apt update
sudo apt install barrier
  • Or, open Ubuntu Software and search for barrier. Install it.
  • Open Barrier application. Open the menu and click on the “Change Settings” option.
  • Set a Screen name for this computer which we will use later for establishing the connection between Client and Server. Click on OK.
  • We will look at the remaining configuration in the Client setup section. Note: You can use your Linux computer as a Barrier Server too. It will have a very similar configuration as macOS.

Barrier Server Setup

  • Linux/macOS/Windows: Open Barrier application. macOS: You can open it from the Applications folder if it is not already running.
  • Default settings are enabled to start it as a Client. Don’t worry, we will change the settings to make it a Barrier Server.
  • From the Barrier’s application menu, open the Change Settings option. Change the locale if required. Set your Barrier Server name. Note: this name we will use letter so keep it simple and recognizable. You can also enable other options.

Don’t change the settings mentioned under the Networking section unless you know what you are doing. Click the OK button and return back on the main screen.

  • Check the Server (share this computer’s mouse and keyboard) option. You may see a warning indicating that the Barrier application will accept the incoming connections. Click the Allow button. After that, click the Start button.
  • You should see indicating that Barrier is connected. Dismiss the dialog and close the main dialog. The Barrier application is now running in the background. You may see the application running in the System Tray.
  • Note down the IP address of your Barrier Server which is also displayed on the main window of the application. For example, in my case, it is 192.168.86.22. We will use this information while setting up the Barrier Client.
  • You can stop the Barrier Server anytime by opening the main application and clicking the Stop button.

Barrier Client Setup

Now, the Barrier Server is ready let’s set up the Client.

  • On your client machine, start the Barrier application.
  • Select the Client option and check the box next to it.
  • Uncheck the Auto config option.
  • Enter the IP address of the Barrier Server that you noted earlier. In my case, it was 192.168.86.22. In your case, it will be something else.
  • Note down the Screen name which should be the same as the name that you set while setting up the Client.

Connect the Server & Client

  • Open the Barrier Server on the computer that will share its keyboard and mouse to be used across other computers running Barrier Client.
  • Click on the Configure Server… button. It should open a dialog to establish screen positioning for the Server and Clients.
  • Drag and Drop the computer icon (Client) 🖥 and place it to the right (or, left) side of the Computer shown in the center. Note: the computer shown in the center is the position of the Barrier Server computer.

If you place the Client computer icon to the right side of Server computer, it would mean that when your mouse’s cursor crosses the right-side boundary of Server computer’s screen; it would start to appear on the Client’s screen.

If you place another Client computer on left side, it would let your cursor appear on Client’s screen when the cursor crosses the left boundary of the screen.

  • Note: you can delete any computer that was either mistakenly placed or for reconfiguration by dragging it to the Trash/Bin icon.
  • In my case, I am keeping the Client computer to the right to my Server computer so naturally, I preferred to place it on the right side of the Server computer on the Server Configuration screen.
  • After placing the Client icon on the Server configuration screen, double click the Client icon to open the Screen Settings dialog. Enter the same Screen name as you set while configuring the Client. Don’t change any other settings. Click OK to save the settings.
  • You may also configure more than one Client.
  • Once done, click the OK button on the Server Configuration dialog.
  • Click Reload button on the Barrier Server main dialog.
  • Go back to the Client computer. By this time, we have already set the configurations. Click the Start button on Client. It may show a Security question dialog. Click the Yes button. In case if Client is already running, you can also simply click the Reload button.
  • You would notice Barrier is running on Server and Client computers.
  • That’s all :)

You are ready to use the Server computer’s mouse and keyboard on the Client computer.

Move your mouse cursor beyond the screen’s edges of your Server computer and it should transition your cursor on the Client’s computer screen. Open a notepad-like application and then type something while the cursor is on the Client computer and you would notice characters being typed on the Client computer.

Congratulations!

--

--