Share input devices between computers with Barrier
Hand in Hand
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.
Installation
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.
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).
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
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Fedora Asahi Remix 41 Available for Apple Silicon
If you have an Apple Silicon Mac and you're hoping to install Fedora, you're in luck because the latest release supports the M1 and M2 chips.
-
Systemd Fixes Bug While Facing New Challenger in GNU Shepherd
The systemd developers have fixed a really nasty bug amid the release of the new GNU Shepherd init system.
-
AlmaLinux 10.0 Beta Released
The AlmaLinux OS Foundation has announced the availability of AlmaLinux 10.0 Beta ("Purple Lion") for all supported devices with significant changes.
-
Gnome 47.2 Now Available
Gnome 47.2 is now available for general use but don't expect much in the way of newness, as this is all about improvements and bug fixes.
-
Latest Cinnamon Desktop Releases with a Bold New Look
Just in time for the holidays, the developer of the Cinnamon desktop has shipped a new release to help spice up your eggnog with new features and a new look.
-
Armbian 24.11 Released with Expanded Hardware Support
If you've been waiting for Armbian to support OrangePi 5 Max and Radxa ROCK 5B+, the wait is over.
-
SUSE Renames Several Products for Better Name Recognition
SUSE has been a very powerful player in the European market, but it knows it must branch out to gain serious traction. Will a name change do the trick?
-
ESET Discovers New Linux Malware
WolfsBane is an all-in-one malware that has hit the Linux operating system and includes a dropper, a launcher, and a backdoor.
-
New Linux Kernel Patch Allows Forcing a CPU Mitigation
Even when CPU mitigations can consume precious CPU cycles, it might not be a bad idea to allow users to enable them, even if your machine isn't vulnerable.
-
Red Hat Enterprise Linux 9.5 Released
Notify your friends, loved ones, and colleagues that the latest version of RHEL is available with plenty of enhancements.