Barrier on Gentoo

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
"The best Linux newsletter on the web"

In this post I’ll show you how to install Barrier on Gentoo Linux. Barrier is an utility to share a keyboard and a mouse between multiple computers, just like we used to do with old school KVM switches.

And why someone would like to do that?. Well, over the end of the last year I’ve changed my job to a homeoffice one. They send me a computer and my desk is a kind of tiny. Take a look at my own messed desktop:

Pictured: screen, notebook, keyboard, thermo, mate, mouse, mouse, another screen, another keyboard

As you see I need to make more room to create a bigger mess. And a way to make more room is to work with the same keyboard and mouse in the two computers.

By the way, we already have a tutorial on how to install barrier on Ubuntu 20.04. Also it’s supposed to work in Windows (I didn’t test yet) and MacOS (I don’t have one).

Installing Barrier on Gentoo

For historical reasons (my personal computer is that old that should be in a museum) I’ve been working with Gentoo, and in this linux distro we install software with emerge, so run as root:

emerge -av x11-misc/barrier
emerging barrier

If portage first complains about USE changes necesary to proceed and then add it to the config files, you need to update that config file running:

I’ve just did an auto merge

Now you can try to emerge again, and wait until the system compile and install barrier and it’s dependencies:

compiling barrier on gentoo

It didn’t took too long to compile in my 10 year old Core i3, on newer computers should end quickly.

just wait until the installation is over

Running barrier on Gentoo

The first time you launch Barrier you’ll be presented with this kind of wizard. The difference between server and client is which computer have the keyboard and mouse connected. In my case I’m going to use the keyboard and mouse from the other computer (the new one they send me to work), so in my Gentoo barrier will be the client.

barrier startup wizard

In the next screen I could change settings again, but I’ll continue to use as client. Just set the ip address of the other computer (or dns name) and that is it.

barrier on gentoo. Client mode
click on Start

To switch computers just move to mouse pointer to the edge of the screen and it will start moving on the other computer.


It does nothing

On my first try the server was in connected mode, but the client was in a perpetual connecting state. I’ve solved by choosing in the menu Barrier → Settings, then disabling SSL. After all, it’s my own LAN at home, I know every device and don’t need that kind of security.

Some basic settings

My keyboard is writting funny

I’m a native spanish speaker, with a keyboard in spanish. And we use accent vowels (á é í ó ú) in lot of words. I soon realize that the accent wasn’t working, it goes like ‘a, ‘e, … etcétera. Also, if I press one of the most important letters, ñ, all I got is “;” . Short story long, when barrier connects, the keyboard layout changes to english.

To fix that I’ve tried several things, and this is the one that works for me:

setxkbmap es -print| xkbcomp - $DISPLAY

Change “es” for your own layout (de, fr,…).

The screen layout is wrong

It could happen that your server computer (the one that shares the mouse and keyboard) is at the right wing of your desktop. So when you move your mouse pointer to the left doesn’t change to the other computer. You can easilly rearrange this layout in the server computer, clicking on “Configure server” button.

barrier on gentoo. screen layout
configure the screens layout

In this screen just drag your screens around the grid to match with the physicall disposition and thats all!.

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
"The best Linux newsletter on the web"
Gonzalo Rivero
Gonzalo Rivero
I am Gonzalo, I live in Salta, a city located in the NW of Argentina. I play the guitar and a little harmonica. I also like to bike.



Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook