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.
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.
My Barrier server configuration. Left to right: MyLinux (PC, Ubuntu), Maximos-Mac-… (my MacPro, macOS).
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).
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.
Install barrier in nixos (vim /etc/nixos/configuration.nix, environment.systemPackages = with pkgs; [ … barrier… ];) and Windows.
Server (let’s say your laptop or PC with Windows): Server (share this computer’s mouse and keyboard), click on Configure Server and do as previously (in this case nixos on the left, myWindows on the right)
Barrier, Change Settings: Start Barrier on startup, uncheck Enable SSL.
Client (NixOS): Client (use another computer’s mouse and keyboard). Screen name (NixOS’s name, e.g., nixos), Server IP (self-explanatory).
Autostart Barrier (nixos). If you are using i3:
``` 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.
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