JustToThePoint English Website Version
JustToThePoint en español
Colaborate with us

How to use and share a single mouse/keyboard across devices

Barrier is a free and open-source KVM forked from Synergy. It mimics the functionality of a KVM switch. It allows you to use and share a single mouse and keyboard across multiple devices. For instance, my macOS (server) and Ubuntu (client).

For Windows and MacOS (brew install barrier), the latest packages are available here. Ubuntu: sudo snap install barrier. Arch: pacman -S barrier.

  1. MacOS: Server (share this computer’s mouse and keyboard). Click on Configure Server…

    Drag and drop the computer icon from the top right to a suitable position. The position is essential because that’s how your mouse pointer will move between screens. Observe that you should provide the hostname of the client computer.Barrier My Barrier server configuration. Left to right: MyLinux (PC, Ubuntu), Maximos-Mac-… (my MacPro, macOS).

  2. Ubuntu: Client (use another computer’s mouse and keyboard). Disable Auto config. Screen name: MyLinux. Server IP: 192.168.1.40 (my MacOS’s IP).

    Maybe you could set up Barrier to run on startup. Launch Startup Applications: Name (Barrier), Command (/usr/bin/barrier).

  3. Set Barrier to automatically launch at boot up (macOS). Go to System Preferences and click Users & Groups. Then, click on Login Items. At the bottom left corner of the window, click on the lock icon and enter your admin password. Click the plus (+) sign, Applications and select Barrier to auto-start.

Barrier

Sharing a mouse and keyboard between Windows and nixOS.

    ``` bash
    gedit .config/i3/config

    exec --no-startup-id barrierc --no-tray --debug INFO --name myWindows 192.168.1.128:24800

–no-startup-id: Prevents i3 from tracking the application, which is useful for applications that do not need to be managed by the window manager. barrierc is the command to start the Barrier client. ‐‐no-tray: Disables the system tray icon for the application. ‐‐debug INFO: Sets the logging level to “INFO”, which will provide detailed output in the terminal for debugging purposes. ‐‐name myWindows: specifies the name of the server as seen by the client. 192.168.1.128:24800: This specifies the server address and port number that the Barrier client will connect to.

Windows PowerShell (as an administrator)
New-NetFirewallRule -DisplayName "Barrier" -Direction Inbound -LocalPort 24800 -Protocol TCP -Action Allow

Create a new firewall rule that allows inbound traffic on a specific port.

  1. New-NetFirewallRule: It creates a new rule in the Windows Firewall.
  2. DisplayName “Barrier”: Sets the name of the firewall rule to “Barrier,” making it easier to identify later.
  3. Direction Inbound: Specifies that the rule applies to incoming traffic.
  4. LocalPort 24800: Indicates that the rule applies to TCP traffic on port 24800, which is used by Barrier for communication.
  5. Protocol TCP: Specifies that the rule applies to the TCP protocol.
  6. Action Allow: Indicates that the rule will allow the specified traffic.
NixOS
vim /etc/nixos/configuration.nix
  networking.firewall = {
    allowedTCPPorts = [ ... 24800 ... ];
    allowedUDPPorts = [ ... 24800 ... ];
  };
 netsh advfirewall firewall add rule name="
 Enable PING" protocol=icmpv4:8,any dir=in action=allow
  1. netsh advfirewall firewall add rule add a new rule to the Windows Firewall.
  2. name=“Enable PING”: Sets the name of the rule, making it identifiable.
  3. protocol=icmpv4:8,any: Specifies the protocol to be ICMPv4, specifically type 8 (which is echo request, used for ping), and allows any code.
  4. dir=in: Indicates that the rule applies to incoming traffic.
  5. action=allow: Specifies that the rule will allow the specified traffic.
Bitcoin donation

JustToThePoint Copyright © 2011 - 2025 Anawim. ALL RIGHTS RESERVED. Bilingual e-books, articles, and videos to help your child and your entire family succeed, develop a healthy lifestyle, and have a lot of fun. Social Issues, Join us.

This website uses cookies to improve your navigation experience.
By continuing, you are consenting to our use of cookies, in accordance with our Cookies Policy and Website Terms and Conditions of use.