Download Barrier to Raspberry Pi
Barrier is used to share a keyboard between Raspberry Pi and other computers: Windows PC, Mac, or Linux (even a second Raspberry Pi).
We’re going to use Barrier to share a keyboard and mouse connected to our Raspberry Pi to a Windows PC on the same network.
First, install Barrier on Raspberry Pi using APT. Open a Terminal and enter:
sudo apt update
sudo apt install barrier -y
Install Barrier on the client
Now download Barrier to your client computer (in our case the Windows PC) from the Barrier GitHub page.
Open the BarrierSetup-2.3.2.exe program (you may have a later version number). Use the corresponding DMG file for macOS – or APT for a Linux, as shown in the previous step.
Make sure all of your computers are connected to the same network before going any further.
Client and server
Now that Barrier is installed on both computers, you need to decide which one is going to be in control. This is the one you will have your keyboard and mouse connected to. This will be the ‘server’ and the other computer will be the ‘client’.
Because we use our Raspberry Pi so much, we’re going to connect our keyboard and mouse to it and have it control the secondary Windows PC. But it could easily be the other way around.
If you’re using a laptop and Raspberry Pi, then it’s probably better to set the laptop as the server (because it will always have a keyboard and mouse attached), and the Raspberry Pi as the client.
Set up the server
Barrier is installed on Raspberry OS, and is opened by choosing Menu > Accessories > Barrier. The Barrier window will appear (below).
Ensure that Server is ticked and make a note of the IP address (on our Raspberry Pi this is 192.168.0.41; on your network the IP address may be different).
Set up the client
Now open the Barrier app on your client machine (in our case a Windows 10 computer).
Deselect the Server checkbox and select Client instead. Enter the IP address for Raspberry Pi into the Server IP text box. On our setup, Raspberry Pi is located at 192.168.0.41 (below). Your IP address may vary – it is displayed in Barrier on Raspberry Pi. Make a note of the screen name for your client computer. Ours is ‘lucyhattersley-dell’.
Configure server
Head back to Barrier on Raspberry Pi and click Configure Server. This will open the Server Configuration window (below).
Now you need to add, and position, the client computer using the Screen Name. Drag the monitor icon from the top-right of the Server Configuration window and place it next to the monitor icon marked ‘raspberrypi’. Ours is positioned to the left of our Raspberry Pi (to match the monitor layout).
The monitor icon will be called ‘Unnamed’. Double-click it to open the Screen Settings window and change the Screen Name to match the client computer – for example in our case, ‘lucyhattersley-dell’ (below). Click OK to close the window.
Start it up
Click Start on Barrier on your server computer (in our case, Raspberry Pi). Wait until the lock icon in the bottom left of the Barrier window displays ‘Barrier is running’.
Now click Start on Barrier on the client computer (our Windows PC). Again, wait for the ‘Barrier is running’ message.
Mouse and keyboard
Move the mouse pointer on your Raspberry Pi over to the left of display and it will flow to the client machine. Now you can use Raspberry Pi’s mouse and keyboard to control the Windows interface. Open an app and click on a text box (such as a web browser and URL box). Now you can use Raspberry Pi’s keyboard to enter text into your Windows computer. It’s now safe to disconnect any keyboard and mouse from the client computer. You’ll be able to use the server keyboard and mouse moving forward.