Barrier

Synergy lets you easily share a single mouse and keyboard between multiple computers (even with different operating systems) without the need for special hardware. It is intended for users with multiple computers on their desk since each system uses its own monitor(s).

Redirecting the mouse and keyboard is as simple as moving the mouse off the edge of your screen. Synergy also merges the clipboards of all the systems into one, allowing cut-and-paste between systems. Furthermore, it synchronizes screen savers so they all start and stop together and, if screen locking is enabled, only one screen requires a password to unlock them all.

Work on Synergy has stalled recently due to Symless (the company behind Synergy) halting further development of the the 1.x branch and concentrating on 2.x branch, which is primarily closed-source, configured through a hosted web interface and requires a paid subscription. A fork called Barrier was created to continue development of the 1.x branch, containing many bug fixes and new features.

Installation

Arch Linux

You can install the synergy or barrier package. There is also a synergy1-binAUR package which however does not include the synergys.service and synergys.socket systemd units.

Note: If you install Barrier, commands and configuration files below are named "barrier" instead of "synergy" - you should use barrierc instead of synergyc, barriers instead of synergys, etc.

Windows and macOS

Download and run the newest Synergy installer from the official website. The official version is paid, although you may compile and run your own builds for free using sources on GitHub. You can also install Barrier for free instead.

Pre-configuration

First determine the IP addresses and host names for each machine and make sure each has a correct hosts file. (You may use IP addresses instead of hostnames as well.)

Server configuration

In Synergy, the computer with keyboard and mouse you want to share is called the server. See Synergy Configuration File Format for a detailed description of all available sections and options.

Arch Linux

Synergy stores its configuration under , Barrier uses or . If the configuration file does not exist, you can use the provided GUI (started with $ synergy or $ barrier, or the desktop launcher) to create it visually. Alternatively you may create it by copying or , whose comments should give you enough information for a basic configuration; if you need further reference or would like to use more advanced options not available from the GUI, read the guide mentioned above.

If you experience problems and you wish to run the server in the foreground, you can run the following command instead:

# synergys -f

The synergy server process needs to attach to your user's X session, which means it needs to run as your user. Enable the synergys.service user unit.

Set up encryption on server

To generate a certificate and fingerprint for the server to use.

For Barrier:

Note: Barrier v2.4.0 introduced a new keyfile format, which requires a SHA256 fingerprint and "v2:sha256:$fingerprint" formatted lines. For older versions, make sure the fingerprints are SHA1 and do not include a prefix.

$ mkdir -p ~/.local/share/barrier/SSL/Fingerprints;
$ openssl req -x509 -nodes -days 365 -subj /CN=Barrier -newkey rsa:4096 -keyout ~/.local/share/barrier/SSL/Barrier.pem -out ~/.local/share/barrier/SSL/Barrier.pem;
$ fingerprint=$(openssl x509 -fingerprint -sha256 -noout -in ~/.local/share/barrier/SSL/Barrier.pem | cut -d"=" -f2);
$ echo "v2:sha256:$fingerprint" > ~/.local/share/barrier/SSL/Fingerprints/Local.txt;

For Synergy:

$ mkdir -p ~/.synergy/SSL/Fingerprints;
$ openssl req -x509 -nodes -days 365 -subj /CN=Synergy -newkey rsa:4096 -keyout ~/.synergy/SSL/Synergy.pem -out ~/.synergy/SSL/Synergy.pem;
$ fingerprint=$(openssl x509 -fingerprint -sha1 -noout -in ~/.synergy/SSL/Synergy.pem | cut -d"=" -f2);
$ echo "$fingerprint" > ~/.synergy/SSL/Fingerprints/Local.txt;

To activate the SSL plugin, add the option. (Note that the Synergy GUI will not let you enable encryption without a valid license, whereas the Barrier GUI allows doing so.)

  • Starting from the command line:
$ synergys --enable-crypto

Windows

  1. Open the Synergy program
  2. Select the option Server (share this computer's mouse and keyboard)
  3. Select Configure interactively
  4. Click the Configure Server... button
  5. This opens a window in which you can add screens depending on how many computers/screens you have: just drag the screen icon in the top-right corner to the screens area, and double-click it to edit its settings
  6. Click OK to close the screens window when you are ready, then click on Start to start the server

On Windows, configuration is saved by default in a file, but its name and location can of course be changed at pleasure.

If you want to start the Synergy server everytime Windows starts, you have to launch the program as administrator, then go to Edit -> Services and select Install in the Server section; note that at the following reboot Synergy will indeed automatically start, but the tray icon will not display automatically (at least for version 1.4.2 beta on Windows 7). To uninstall the service, do the same thing but obviously select Uninstall.

If you want to start the server from the command-line, here is a Windows command you can place in a file or just run from :

C:\Program Files\Synergy+\bin\synergys.exe  -f --debug ERROR --name left --log c:\windows\synergy.log -c C:/windows/synergy.sgc --address 10.66.66.2:24800

macOS

macOS has a similar configuration as Unix: check the official documentation for more information.

Configuration examples

This is an example for a basic 3-computers setup:

This should be the example bundled with the Arch Linux package:

/etc/synergy.conf
section: screens
        # three hosts named:  moe, larry, and curly
        moe:
        larry:
        curly:
end

section: links
        # larry is to the right of moe and curly is above moe
        moe:
                right = larry
                up    = curly

        # moe is to the left of larry and curly is above larry.
        # note that curly is above both moe and larry and moe
        # and larry have a symmetric connection (they're in
        # opposite directions of each other).
        larry:
                left  = moe
                up    = curly

        # larry is below curly.  if you move up from moe and then
        # down, you'll end up on larry.
        curly:
                down  = larry
end

section: aliases
        # curly is also known as shemp
        curly:
                shemp
end

The following is a more customized example:

synergy.sgc
section: screens
	leftpc:
		halfDuplexCapsLock = false
		halfDuplexNumLock = false
		halfDuplexScrollLock = false
		xtestIsXineramaUnaware = false
		switchCorners = none +top-left +top-right +bottom-left +bottom-right 
		switchCornerSize = 0
	rightpc:
		halfDuplexCapsLock = false
		halfDuplexNumLock = false
		halfDuplexScrollLock = false
		xtestIsXineramaUnaware = false
		switchCorners = none +top-left +top-right +bottom-left +bottom-right 
		switchCornerSize = 0
end

section: aliases
leftpc:
10.66.66.2
rightpc:
10.66.66.1
end

section: links
	leftpc:
		right = rightpc
	rightpc:
		left = leftpc
end

section: options
	heartbeat = 1000
	relativeMouseMoves = false
	screenSaverSync = false
	win32KeepForeground = false
	switchCorners = none +top-left +top-right +bottom-left +bottom-right 
	switchCornerSize = 4
end

Clients configuration

Arch Linux

In a console window, type:

$ synergyc server-host-name

Or, to run synergy in the foreground:

$ synergyc -f server-host-name

Here, is the host name of the server.

Set up encryption on client

If you use the synergy command line client, copy the file containing the fingerprint from the server into the clients home directory . To start the synergy command line client with encryption, type:

$ synergyc --enable-crypto server-host-name

If you want to enable the SSL trust without requiring the GUI on the client you can follow the steps below, but you should confirm the fingerprint that gets displays is the same one your server has in its GUI or in the on the server per above. The `echo -n` is required to avoid the openssl client hanging waiting for input.

For Barrier:

Note: Barrier v2.4.0 introduced a new keyfile format, which requires a SHA256 fingerprint and a "v2:sha256:$fingerprint" line format. For older versions, make sure the fingerprints are SHA1 and do not include a prefix.

$ mkdir -p ~/.synergy/SSL/Fingerprints
$ fingerprint=$(echo -n | openssl s_client -connect $YOUR_SYNERGY_SERVER:24800 2>/dev/null | openssl x509 -sha256 -noout -fingerprint | cut -d"=" -f2);
$ echo "v2:sha256:$fingerprint" > ~/.synergy/SSL/Fingerprints/TrustedServers.txt

For Synergy:

$ mkdir -p ~/.synergy/SSL/Fingerprints
$ fingerprint=$(echo -n | openssl s_client -connect $YOUR_SYNERGY_SERVER:24800 2>/dev/null | openssl x509 -sha1 -noout -fingerprint | cut -d"=" -f2);
$ echo "$fingerprint" > ~/.synergy/SSL/Fingerprints/TrustedServers.txt

Autostart

There exist several ways to automatically start the Synergy client, and they are actually the same that can be used for every other application.

  • You can add the next line to your xinitrc:
~/.xinitrc
...

#replace server-host-name with the real name
synergyc server-host-name

The following is an alternative:

~/.xinitrc
XINIT_CMD='/usr/bin/synergyc -d FATAL -n galileo-fire 10.66.66.2:24800'
/usr/bin/pgrep -lxf "$XINIT_CMD" || ( ( $XINIT_CMD ) & )
synergyc server-host-name
  • To start the Synergy client with systemd, create a service file:

Then do a daemon-reload and start the user unit.

To start the service at login for your user, enable it as a user unit.

Automatically starting Synergy is also documented in its official reference page.

Windows

After installation, open the Synergy program, select the option Client (use another computer's keyboard and mouse) and type the host name of the server computer in the text box, then click Start to start the client.

If you want to start the Synergy client every time Windows starts, you have to launch the program as an administrator, then go to Edit -> Services and select Install in the Client section.

If you want to start the client from the command-line, here is a Windows command you can place in a file or just run from . This points to a configuration file in and runs in the background like a service.

macOS

Locate the synergyc program in the synergyc folder and drag it onto the terminal window: the full path will appear in the terminal. Now append the host name of the server, so that the complete command will look like this:

Then press .

Known issues

If Arch is being used as a client in a Synergy installation, the server may not be able to wake the client monitor. There are some workarounds, such as executing the following via SSH, if ACPI is enabled (see: Display Power Management Signaling#Modify DPMS and screensaver settings with a command):

Troubleshooting

The official documentation has a FAQ and also a troubleshooting page.

Keyboard AltGr

If you encounter problems with AltGr add

altgr = alt       #1.8.2
altgr = shift     #v1.8.3 and higher

on the screen/client section in /etc/synergys.conf.

Keyboard repeat

If you experience problems with your keyboard repeat on the client machine (Linux host), simply type:

# /usr/bin/xset r on

in any console.

Keyboard mapping

If you experience problems with the keyboard mapping when using the server's keyboard in a client window (e.g a terminal) then re-setting the X key map after starting synergyc may help. The following command sets the keymap to its current value:

# setxkbmap $(setxkbmap -query | grep "^layout:" | awk -F ": *" '{print $2}')

No cursor in Gnome

When GNOME does not detect a mouse, it will default to touchscreen mode and hide the cursor. To enable run:

# dconf write /org/gnome/settings-daemon/plugins/cursor/active false

This can be added to an init script or systemd unit:

 ExecStartPost=dconf write /org/gnome/settings-daemon/plugins/cursor/active false

Mixing xorg and wayland environments also does not currently work. Try starting gnome in xorg for both client and server.

Client is returning "failed to verify server certificate fingerprint"

You need to copy the content of server's "~/.synergy/SSL/Fingerprints/Local.txt" into client's "~/.synergy/SSL/Fingerprints/TrustedServers.txt". See #Set up encryption on client.

Scroll Lock LED does not light

When using Scroll Lock to lock to a client (or to enter relative mouse move mode), you may run into an issue with your keyboard's Scroll Lock LED not lighting. This can be solved by binding the Scroll_Lock key to an empty modifier key.

First, find an empty modifier. In this case, mod3 is available:

 $ xmodmap
 xmodmap:  up to 4 keys per modifier, (keycodes in parentheses):
 
 shift       Shift_L (0x32),  Shift_R (0x3e)
 lock        Caps_Lock (0x42)
 control     Control_L (0x25),  Control_R (0x69)
 mod1        Alt_L (0x40),  Alt_R (0x6c),  Meta_L (0xcd)
 mod2        Num_Lock (0x4d)
 mod3
 mod4        Super_L (0x85),  Super_R (0x86),  Super_L (0xce),  Hyper_L (0xcf)
 mod5        ISO_Level3_Shift (0x5c),  Mode_switch (0xcb)
 

Then, add the new mapping.

 $ xmodmap -e 'add mod3 = Scroll_Lock'
 $ "echo "add mod3 = Scroll_Lock" >> ~/.Xmodmap

See Xmodmap#Activating the custom table to have loaded on login.

After making this change, test the LED and screen locking. If you find that you need to press Scroll Lock twice to lock screens, enable on all screens in .

Additional mouse buttons do not work in client

If you find that additional mouse buttons (i.e. Mouse4/Mouse5) do not translate to a client, try adding the following to :

 mousebutton(6) = mousebutton(4)
 mousebutton(7) = mousebutton(5)

This will re-map the mouse keys to the proper number. If that does not fix the problem, remove the configuration, stop Synergy, and start it in the foreground with debug logging enabled:

 $ synergys -f -d DEBUG1

Then, move your cursor to the screen of the client with the issue. Click the non-functioning keys, and watch for log entries like this:

 [2017-09-30T14:56:45] DEBUG1: onMouseDown id=6
 ...
 [2017-09-30T14:56:46] DEBUG1: onMouseUp id=6

The part will have the right number to use in

mouse fixed in certain games

In some applications (like Overwatch or other games) the cursor gets trapped in the middle of the screen.

According to https://github.com/symless/synergy-core/issues/2631 this is an issue that is known.

Just set relative mouse movement in your settings and make sure to lock the screen.

gollark: I'm pretty sure it supports both, and `>=` should work the same as in... every other same programming language?
gollark: You *could* probably do a GET request in a way which returns a stream, then just read the headers and close it.
gollark: KVM switches.
gollark: ```httposmarks@fenrir /tmp> curl -I https://osmarks.tk/HTTP/2 200 server: nginx/1.18.0date: Sat, 26 Sep 2020 21:48:23 GMTcontent-type: text/htmlcontent-length: 11144last-modified: Mon, 21 Sep 2020 17:33:13 GMTetag: "5f68e3d9-2b88"strict-transport-security: max-age=63072000; preload; includeSubDomainsreferrer-policy: strict-origin-when-cross-originaccept-ranges: bytes```
gollark: `curl -I` can do that.
This article is issued from Archlinux. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.