Share input devices between computers with Barrier

Hand in Hand

© Lead Image Cytonn Photography on Unsplash

© Lead Image Cytonn Photography on Unsplash

Article from Issue 224/2019

Barrier is a Synergy fork that lets you work with one keyboard and mouse pair on multiple Linux, Mac OS X, or Windows computers.

Attaching two monitors to the same computer offers some very significant benefits for a user who works on a computer all day. However, a two-monitor configuration is not always the right solution for the task. In some cases, what you really need is two separate computers. For instance, you might want to run a Windows and a Linux system side by side without contending with the complications of virtualization. Software developers, sys admins, graphic artists, and documentation specialists all still face scenarios where it still makes sense to put two computers on the same desk.

One of the biggest irritations about running two desktop computers is the clutter of all the devices. Two complete systems means not just two monitors but also two keyboards and two mice.

Hardware solutions for sharing devices have existed for years. KVM switches (the acronym stands for Keyboard/Video/Mouse) make it possible to use two or more computers with a single set of input and output devices. More recently, users have turned to less expensive software solutions. Many Linux users are familiar with Synergy [1], a commercial, software-based device sharing tool that is available for $29-$39.

If you're looking for a free solution, Barrier [2] is an interesting alternative to Synergy (see box entitled "A Look Back"). The Barrier program, which is licensed under the GPL, is a fork based on the Synergy source code. Barrier is supported by a community that provides setups and binaries for users. The goal of the Barrier developers is to catch up with capabilities of Synergy 1.9 (the original has now reached version 1.10.1) and to offer a simple and reliable solution for controlling multiple computers.

A Look Back

Synergy evolved from a tool called CosmoSynergy that was never marketed publicly. The Synergy application is now run by Symless as an open source project under the GPLv2. In 2014, however, the company found itself forced to remove the binaries it had previously offered free of charge from its homepage due to the start-up costs that were difficult to refinance. If you have the appropriate skills, Synergy can still be built from the source code [3].

However, if you simply want to download and install the software on your computers via setup or as a package, you need to purchase a license for $29 ($39 for the Pro version) for each user in your household or business. The license fee includes technical support and lifetime download access. An update to the currently available beta version of Synergy 2 (scheduled for the end of 2019) will cost additional money.


Barrier is not found in the package sources for most major distributions. Only Arch Linux has a recipe for building the program in the Arch User Repository (AUR). With the help of an AUR helper – currently Yay is recommended – Barrier can be installed on Arch with little effort. Our practical test of the application also took place under Arch.

Users of other platforms will want to access the binaries provided on the project wiki [4]. You'll find an installer for Windows, a DMG package for Mac OS X, and statically built versions for Linux and FreeBSD. In practice, however, the Linux package's hard-wired dependency on Qt 5.12 poses a hurdle: Even Ubuntu 18.10 still relies on Qt 5.11.1, which means you'll need to upgrade to Qt 5.12 to use Barrier.

Just like Synergy, and other remote desktop solutions such as TeamViewer, Barrier has difficulties with the Wayland graphics environment. These problems have been reported on the project's bug tracker, but so far no developer has been found to take on the task [5]. If you are working with a desktop that uses Wayland, you will need to switch to a traditional X11 desktop. In Gnome, for example, you can switch using the login manager's gear menu.

For your initial tests on Linux, you might prefer to use Flatpak to install Barrier on your system [6]. On Ubuntu (tested with Ubuntu 18.04 and 18.10), you need to install Flatpak, load the software repository and the KDE repository, and then set up Barrier as the final step (Listing 1). The program does not add a starter to the application menu, so you have to launch Barrier manually (Listing 1, Line 5).

Listing 1

Adding Barrier with Flatpak


The Flatpak environment also supports easy uninstallation. To uninstall, use the flatpak list command to display the Flatpak packages installed on the system and then use flatpak uninstall to delete the Flatpak packages installed during the Barrier installation. In the example from Listing 2, these packages would be the four listed by the list command.

Listing 2

Uninstalling in Flatpak


Better from the Source Code

For the best possible install right now, check out the source code [7]. You'll need to first update the system, import the libraries required for building the program, retrieve the code, and then build the application. Listing 3 shows the process; adjust the version number in the commands if necessary.

Listing 3

Installing from Source Code


We tested the procedure on Ubuntu 18.04 and 18.10, but it can also be applied to Debian and Raspbian. The last step shovels the program onto the system; you can then call it with the barrier command – and also via a starter from the application menu of the desktop environment.

Start and Configuration

On first launch, a wizard guides you through the basic configuration. In the first section, select English as the language. Then decide whether Barrier will act as a client or server. The keyboard and mouse are attached to the server, and you control the client(s) via the input devices connected to the server (Figure 1). You will thus first need to set up the server system.

Figure 1: Barrier's initial setup wizard is used to configure the role of the system. The keyboard and mouse must be attached to the server.

In the next step, Barrier opens the application window (Figure 2). You don't have to change anything; the most important step is to select Configure interactively: and then select Configure server…. Then use the grid to compare the physical arrangement of the displays on your desk with Barrier. Use the mouse pointer to drag the template monitor from the upper-right corner to the desired field in the grid (Figure 3).

Figure 2: The main Barrier dialog has few options. The IP addresses for the server and the client are important.
Figure 3: In the server configuration, you need to compare the layout used by Barrier with the physical arrangement of the displays on your desktop.

Double-click the unnamed monitor with the left mouse button and match the display name with the client's display name, usually the client's host name. If you are working with a desktop environment that has an active corner (such as Gnome's Activities menu), it is best to activate the entry "Dead" Corners Top Left and set the size to, say, 10. The mouse pointer remains in the upper-left corner as usual and does not move to the left screen.

If necessary, delete unused client machines from the configuration by dragging the virtual monitor to the trash can icon in the top-left corner of the server configuration window. Finally, close the configuration window and activate the server service by clicking Start.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Synergy

    Synergy lets you combine multiple PCs into a single virtual desktop.

  • Share Mouse and Keyboard with QuickSynergy
  • FOSSPicks

    This month Graham looks at MScSim, Ticker, vizex, and more!

  • Free Software Projects

    Controlling two desktops with a single set of input devices: X2X and Synergy let the mouse cursor cross seamlessly between the desktops on two machines. Wikipedia founder Jimmy Wales looks to revolutionize politics with his Wikia Campaigns project. French Debian developers join forces to found Debian France, and introducing the new graphical installer for Sarge.

  • Write Barriers

    Your journaling filesystem is carefully tracking write operations – but what happens when the data gets to the disk? A write barrier request can help protect your data.

comments powered by Disqus

Direct Download

Read full article as PDF:

Price $2.95