Synergy
From Gentoo Linux Wiki
Contents |
[edit] Introduction
Synergy lets you use one keyboard and mouse across multiple computers across different Operating Systems. To do so it requires that all the computers are connected to each other via TCP/IP networking. Most systems come with this installed.
This tutorial follows the general layout of the the official installation procedure, but with Gentoo-specific commands.
[edit] Install
Install Synergy on every computer :
(Your computers doesn't have to run the same Operating System. The tutorial here shows how to do it in Gentoo, but you can mix your setup with any other flavour of Linux, Windows and MacOS)
[edit] Configure
Synergy is configured with a plain text file. A well-commented sample configuration is provided, just make sure to check it out. For any further documentation please refer to the official website (link in the See Also section).
[edit] Start the Server
The server is the computer that possess the keyboard and mouse you want to share across the others. Start the server on your main computer by doing the following as a normal user (not root) :
Possible parameters :
- -a <address> : Adresse(s) to listen for clients. (If omited, will listen to all);
- -c <config-file>: Specify a different configuration file;
- --display <display>: Connect to the XServer at <display>;
- -f : Run server in foreground;
- -n <screen-name> : Identifies the screen by it's name instead of it's IP or Hostname;
- -l : Do not try to restart the server if it fails;
[edit] Start the Client(s)
Launch the clients that will act as secondaries screens using this command as a normal user (not root) :
Changing hostnameoripofserver by the host name or the IP of the server.
[edit] Running in the background
If you omit the -f parameter used in the above steps, the program will run silently and return your console to shell while running. You should do this once your verified that everything is working fine and debugging potential errors with the -f parameter.
[edit] Setting up an init script
As root, create the following files : /etc/init.d/synergy and /etc/conf.d/synergy
In the /etc/init.d/synergy file, write :
#!/sbin/runscript
# /etc/init.d/synergy
# $Header: $
depend() {
use xdm net
}
start() {
ebegin "Starting synergys"
# the following line might be necessary to allow the connection to the x-server
export XAUTHORITY=/home/${SYNERGY_USER}/.Xauthority
start-stop-daemon --start -b -v -p /tmp/synergys.pid -m -c ${SYNERGY_USER} -x ${SYNERGY_EXEC} -- ${SYNERGY_OPTS}
eend $? "Failed to start synergys"
}
stop() {
ebegin "Stopping synergys"
start-stop-daemon --stop -x ${SYNERGY_EXEC} -p /tmp/synergys.pid -q
eend $? "Failed to stop synergys"
}In the /etc/conf.d/synergy file, write:
#/etc/conf.d/synergy SYNERGY_EXEC="/usr/bin/synergys" SYNERGY_USER="yourusername" #Usage: synergys [--address <address>] [--config <pathname>] [--debug <level>] [--display <display>] [--name <screen-name>] [--restart|--no-restart] [--daemon|--no-daemon] # #Start the synergy mouse/keyboard sharing server. # # -a, --address <address> listen for clients on the given address. # -c, --config <pathname> use the named configuration file instead. # -d, --debug <level> filter out log messages with priorty below level. # level may be: FATAL, ERROR, WARNING, NOTE, INFO, # DEBUG, DEBUG1, DEBUG2. # --display <display> connect to the X server at <display> # -f, --no-daemon run the server in the foreground. #* --daemon run the server as a daemon. # -n, --name <screen-name> use screen-name instead the hostname to identify # this screen in the configuration. # -1, --no-restart do not try to restart the server if it fails for # some reason. #* --restart restart the server automatically if it fails. SYNERGY_OPTS="-f -a hostnameoripofclient(s) --display ':0' -n gentoo"
- Replace yourusername in the SYNERGY_USER variable by your username since Synergy should not be run as root;
- Modify the SYNERGY_EXEC variable according to your needs: /usr/bin/synergys for the server or /usr/bin/synergyc for a client;
- Modify the SYNERGY_OPTS variable according to your needs. Note that you should use the -a parameter for enhanced security. You should let the -f parameter on this variable, otherwise starting and stopping function might not work correctly.
- If you configure a client, make sure the IP or Hostname of the Synergy server is the last argument
Make the script executable :
Add the script to the default run level:
[edit] Troubleshooting
Lag synergy client: you can fix this problem lunching synergy client as root. you have to allow xserver acces to root:
Down and Left-Arrow Keys not repeating on client (gnome): You may want to take a look at this workaround described on https://bugs.launchpad.net/ubuntu/+source/gnome-settings-daemon/+bug/278078/comments/43:
On the gnome-client execute the following command after synergyc has been started. Move the mouse-pointer to the synergy-server and back to the client after executing the command. This seems to "activate" the new settings.
