Sharing mouse and keyboard on Ubuntu with Synergy

For controlling my desktop (keyboard and mouse) from my notebook,  I’m using Synergy. This means, I’m using keyboard and mouse from my notebook and can seamless control notebook and desktop with them. The mouse pointer moves from the notebook display to the desktop display as it is one computer.

On the notebook, it will run as a server, on the desktop as client. The description here is written for Ubuntu 16.04.

Notebook / Server

Simple solution, a shell script which kills old running synergys processes and starts a new one. It is places in the home folder and named start-synergy.sh.

#!/bin/bash
killall -r synergys
synergys -c ~/synergy.conf -d WARNING --daemon --log /var/log/synergy.log --restart

Open the dash and search for „Startup applications“. Add a new entry, name it „Synergy“ and add the shell script like this: /home/yourusername/start-synergy.sh

 

Desktop / Client

On the clientside I use a feature from LightDM (the windows manager used in Ubuntu 16.04) to execute commands in special cases (called system hooks, see https://wiki.ubuntu.com/LightDM for some infos).

Create a new config file:

sudo joe /etc/lightdm/lightdm.conf.d/50-synergy.conf

and add the following lines:

[SeatDefaults]
display-setup-script=/usr/bin/synergyc --daemon -d WARNING --log /var/log/synergy.log serveradress

serveradress can be the ip adress or hostname of your synergy server. In my case it is ZenbookLAN.fritz.box:

[SeatDefaults]
display-setup-script=/usr/bin/synergyc --daemon -d WARNING --log /var/log/synergy.log ZenbookLAN.fritz.box

Save the file and logout. If the server is running on your notebook (or what machine you using as server), try to move the mouse pointer to the client. If it is not working, restart the client machine. Then it should work.

In my case with this configuration I had a problem with the screen sharing. My desktop has 4 displays connected, but only the upper 2 could be accessed with this configuration. After login on the desktop (client) I have to restart the synergyc process, then it is working. Right now I could not find a different solution then to write a little script, which kills the running synergyc process and restarts it. Create a file start-synergy.sh in your home directory on the desktop (client):

#!/bin/bash
sudo killall synergyc
/usr/bin/synergyc --daemon -d WARNING --log /var/log/synergy.log serveradress

serveradress can be the ip adress or hostname of your synergy server. In my case it is ZenbookLAN.fritz.box.

Now everytime you login on the desktop (client) start this script manually (you have to enter your password because we need sudo for killing the process).

 

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.