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:
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
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:
etc-update
Now you can try to emerge again, and wait until the system compile and install barrier and it’s dependencies:
It didn’t took too long to compile in my 10 year old Core i3, on newer computers should end quickly.
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.
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.
To switch computers just move to mouse pointer to the edge of the screen and it will start moving on the other computer.
Troubleshooting
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.
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.
In this screen just drag your screens around the grid to match with the physicall disposition and thats all!.
[…] UNIX Cop ☛ Barrier on Gentoo […]