Barrier: an introduction

Background for cover image excerpted from photo by Peter Hulce on Unsplash

What is barrier?

To reduce the number of keyboards and mice you can get a physical KVM switch but the down side to the physical KVM switch is it requires you to select a device each time you want to swap. barrier is a virtual KVM switch that allows one keyboard and mouse to control anything from 2-15 computers and you can even have a mix of linux, Windows or Mac.

Don’t confuse Keyboard, Video and Mouse (KVM) with Kernel Virtual Machine (KVM) they are very different and this article will be covering the former. If the Kernel Virtual Machine topic is of interest to you read through this Red Hat article https://www.redhat.com/en/topics/virtualization/what-is-KVM that provides an overview of the latter type of KVM.

Installing barrier on Fedora Linux (KDE Plasma)

Enter Alt+Ctrl+T to display the terminal screen and you will enter the following to download barrier from the Fedora system repository.

$ sudo dnf install barrier

Installing barrier on Windows and Mac

If you are looking to install on alternate operating systems you can find the Windows and Mac downloads here: https://github.com/debauchee/barrier/releases.

Nuances of version 2.3.3

  • barrier does not support Wayland, the default display protocol used in both Gnome and KDE, so you will need to switch your desktop to use the X11 protocol to use barrier.
  • If you are unable to move your mouse from the host to a client computer, make sure you do not have scroll lock enabled. If scroll lock is enabled it will prevent the pointer from moving to a client.
  • When using more then one Linux machine, verify you are using the same version of barrier on each one (thanks to @ilikelinux for pointing this requirement out). If you need to check your version enter the following at the terminal.
$ dnf list barrier

To use X11 in KDE:

  1. Select the Fedora icon in the bottom left
  2. Select Leave on the bottom right of the menu
  3. Select Log Out
  4. Select OK
  5. Select Desktop Session on the bottom left side of the screen and select X11
  6. Log back in

Set up your barrier host

At the command line type barrier and the main screen will display.

$ barrier
  1. Select the check box next to Server (share this computer’s mouse and keyboard)
  2. Click the Configure Server… button
Barrier

You should now be on the Screens and links tab. Here you will see a recycle icon on the top left and a blue monitor icon on the top right.

To add a client, drag the blue monitor icon to the location you want your monitor to be when you move the mouse from your host to client device. Think of this as how you would want a multi-monitor setup to appear.

If you want to remove one drag the blue monitor to the recycle bin.

Barrier Server Configuration

After you have setup a client in the location grid, double click the same icon to open the Screen Settings dialog box.

Barrier Screen Settings
  1. Fill in the Screen name field with whatever name you would like.
  2. Under Aliases type a different name and select Add.

At this point, your host is ready to go and you can click the Start button on the bottom right of the screen.

Barrier

Note: Depending on your current firewall configuration, you might need to add an exception for the synergy service so that network connections to that port (24800/tcp) can get through to your barrier server. You probably want to restrict this access to only a select few source IP addresses (barrier clients).

Set up your barrier client

The barrier client side setup is very simple.

  1. Start barrier on the client machine.
  2. Select the check box next to Client (use another computer’s mouse and keyboard)
  3. From the host computer you can look at the IP addresses field and copy its value to the Server IP field on the client.
  4. Click Start on the bottom right.
Client on Microsoft Windows 10

Conclusion

From this point on, you can move your mouse between each computer you added and even copy and paste text back and forth just like they are on the same computer. barrier has numerous options you can use to tweak the program under the Hotkeys and Advanced server settings tabs on the host. Now that you are up and running, go ahead and spend time messing around with different options to see what suites you best.

Note: barrier requires that the each host has a physical display.

Using Software

22 Comments

  1. Osqui

    No Wayland, no future. Sorry

  2. Ralf Seidenschwang

    Very helpful Matthew. I hope I can replace my physical KVM switch with a proper barrier setup and a dedicated host.
    Thanks a lot!

  3. Until you find a way to work with Wayland this is of no use to me. I had to abandon Synergy for the same reason.

    I know there are nasty technical barriers, not least that the Wayland development cabal utterly refuse to recognize this as a valid use case and will do anything in their power to block you (*)

    Wntil the community sorts it’s act out (eg, maybe Fedora/Redhat could apply pressure to the Wayland immovables) I’m stuck with two keyboards and mice on my desk.

    (*) To the wayland devs the connection between a machines keyboard/mouse and desktop is a precious thing and may not be interrupted for any reason because security.

  4. Marcus

    We honestly need to start settling with either deprecating Wayland-incompatible tools (like barrier, but also, like many screenshotting and -sharing tools) and fostering the implementation of Wayland alternatives,

    Or we roll back the defaulting to Wayland.

    Honestly, Wayland turns 13 in a good month; it’s been the default in some very large Linux distros. It’s yet to reach feature parity with Xorg. I love wayland, but as long as we, as userland community, keep propagating X-only tooling, we don’t have anyone to blame but ourselves for yet another decade of adding layers upon layers of X-related workarounds.

  5. edier88

    Thank you. I use it every day in my work as my job demands me to use Windows. I switch from Fedora to Windows in no time with Barrier, two machines with the same mouse and keyboard.
    I hope this helps people with the same problem as me.

  6. Mayost Sharon

    First of all thank you very much for the article

    If I understood correctly
    The difference between physical KVM and
    1. Physical KVM does not have to be connected to an IP network whereas in virtual KVM there must be a connection between computers via an IP address

    If the client runs high graphics software in physical KVM it will work fast whereas through virtual KVM it will work slowly

    Thank you

    • Mayost,
      You are correct on the difference of operation. You may notice some delays if you are using a large amount or resources for something else that is not on the hosting device.

      • Mayost

        Hello
        I seem to have been confused

        Physical KVM lets you control several computers using just one keyboard, mouse and screen
        In contrast, the software only gives the keyboard and mouse without a screen
        So basically it’s not K.V.M it’s K.M.

        Thanks

        • @Mayost: Thanks. I (the editor for this article) misunderstood that as well. I have placed a “Note:” at the end of the article to state that a physical display is always necessary.

  7. Nicolás Díaz Lozano

    I have a low cost laptop setup with xfce and a desktop with a single monitor. This software is really useful to me and I did not know about it. Thanks.

  8. Fred

    Articles about things that do not work by default on fedora keep popping up in the magazine.
    It’s ok to be technical sometimes (podman, etc.) but imho articles should be in the continuity of what’s available by default on the distro, in that case, Gnome and Wayland.
    This one is just plain confusing for beginners and will only lead to disappointment once KDE session switches to wayland.

    • Hello Fred,

      Thank you for the feedback. Are you a beginner? I would be interested to hear the points that caused confusion for you?

    • @Fred:

      Generally, Fedora Magazine accepts anything FOSS that works on the newest release of Fedora Linux. Other than that, the topics are community driven. The editors at Fedora Magazine do not try to steer what we think people should be interested in. If you want to see more articles about GNOME and/or Wayland, you will have to write them or convince others to write them. Thanks.

      • Fred

        Hi Gregory, Matthew
        Most articles have great content, including this one, in and of itself. I just believe that articles “in the magazine, in the default fedora homepage” would be a better fit if they explained things that have a 100% chance to still work two or three Fedora releases from here. Fedora is very much Gnome+systemd+wayland+pipewire+flatpak as its core
        This one in particular implies switching from Gnome to Kde, which is a fine DE too, and as a consequence, if i’m not mistaken, from Wayland to X11 also.
        For example, if an article popped up that told user how to replace pipewire by pulseaudio, or alsa with OSS, or systemd by openrc, flatpak by snapd, I would feel the same way: It’s at odds with what technical contributors try to provide in Fedora. It’ll still be interesting content though, because tinkering is a great way to learn.
        But down the road I think that it can create frustrated users, adopting workflows or software that may stop working sooner than later. I think Owen’s and Marcus earlier comments resonates with mine.
        I see there are also enthusiastic comments about this article, so there’s definitely an audience for well-written, detailed content, I also understand the balance wrt steering content vs having any content at all, so thank you both for this magazine and this article.

  9. miscdev

    I think if you have Wayland and XWayland it will work.

    I have 3 monitors running Wayland, with xwayland, and three windows 10 monitors. It all works for me.

  10. Thalita

    I use synergy this perfect too.

  11. Glenn Johnson

    Works well. Now I can get rid of three keyboards and three mice.

    • Ralf Seidenschwang

      I’m trying to imagine your workplace from before with a total of 4 keyboards and mice and have to think of an octopus. It is a very helpful tool.
      To be honest, this keyboard problem has often kept me from programming or scripting something.
      I would like to get more of these tips!

  12. Ralf Seidenschwang

    I have an issue that probably can be solved via the settings. I have an old Macintosh computer as a server, and a linux box as a client.
    Mac has other keybindings for special characters like the @ in the German language. Normally, you use the Option (or Alt) ⌥ key and “L” to get the @-symbol.
    Switching to the Linux client, it‘s not possible to print the @ symbol to screen, neither with the keyboard shortcut Option (or Alt) ⌥ key and “L”, nor with the “Alt Gr” and “Q” shortcut.
    Has anyone solved such key mapping problems?

  13. David Levner

    I find Barrier to be very helpful. Thank you. I managed to set up startup commands to run a barrier server and a barrier client when I log in to the computers I use as the server and client. In my environment (I use KDE plasma), I created bash scripts in the ~/.config/autostart-scripts directory. I’m not sure if applies to all Fedora users.

    To determine what to put in the scripts, I started the server and client with the
    ‘barrier’ user interface program and, in a shell, ran the command ‘ps aux | grep barrier’.

Comments are Closed

The opinions expressed on this website are those of each author, not of the author's employer or of Red Hat. Fedora Magazine aspires to publish all content under a Creative Commons license but may not be able to do so in all cases. You are responsible for ensuring that you have the necessary permission to reuse any work on this site. The Fedora logo is a trademark of Red Hat, Inc. Terms and Conditions