Autostart Synergy before logging in (GDM/MDM)
Source: https://help.ubuntu.com/community/SynergyHowto
Note: Autostarting Synergy before logging in requires that your network connection be available at all times and not just after you log in. This is accomplished by enabling the network connection for all users.
To do this, choose System -> Preference -> Network Connections. Choose the network name and select Edit. Select "Available to all users", and then click "Apply". This connection will now be available at all times, including at the GDM login screen.
To make sure synergy is running at all times, the following has to happen: First, synergy is started when the GDM login screen starts. Then, synergy is killed and restarted when a user logs in. When the user logs out, synergy is killed and GDM starts it again. To edit system configuration files in the following sections open a text editor as the root user, e.g.: sudo gedit
Note: "gdm" replaced by "mdm" as used on LMDE & Mint.
On the Server
At the end of the file /etc/mdm/Init/Default
, just before the line that says exit 0
add the following:
/usr/bin/killall synergys
while [ $(pgrep -x synergys) ]; do sleep 0.1; done
/usr/bin/synergys
Add the following to the end of /etc/mdm/PostLogin/Default
(create this file file if it does not already exist):
/usr/bin/killall synergys
while [ $(pgrep -x synergys) ]; do sleep 0.1; done
If you created the file, make sure it is executable with this command:
sudo chmod +x /etc/mdm/PostLogin/Default
Now, create a session file /etc/X11/Xsession.d/85synergys
with the following contents
/usr/bin/killall synergys
while [ $(pgrep -x synergys) ]; do sleep 0.1; done
/usr/bin/synergys
Lastly, we must make the file executable with this command:
sudo chmod +x /etc/X11/Xsession.d/85synergys
On the Client
At the end of /etc/mdm/Init/Default
, just before the line that says exit 0
add the following:
/usr/bin/killall synergyc
while [ $(pgrep -x synergyc) ]; do sleep 0.1; done
/usr/bin/synergyc <SERVER HOSTNAME>
Be sure to replace
NOTE: If your system has been configured to login automatically, this step may cause (ubuntu) to hang right before going to the desktop. If this is the case, remove these lines from /etc/mdm/Init/Default
and everything should work properly. If your system is hanging at this stage, you can hit CTRL-ALT-F1 to login through command line and edit this file.(Tested on 10.04LTS Lucid Lynx)
Add the following to the end of /etc/mdm/PostLogin/Default
(create this file file if it does not already exist):
/usr/bin/killall synergyc
while [ $(pgrep -x synergyc) ]; do sleep 0.1; done
If you created the file, make sure it is executable with this command:
sudo chmod +x /etc/mdm/PostLogin/Default
Now, create a session file /etc/X11/Xsession.d/85synergyc
with the following contents
/usr/bin/killall synergyc
while [ $(pgrep -x synergyc) ]; do sleep 0.1; done
/usr/bin/synergyc <SERVER HOSTNAME>
This will run synergyc when any user logs in. Be sure to replace
sudo chmod +x /etc/X11/Xsession.d/85synergyc
/etc/synergy.conf
On the Server:
section: screens
multivac:
halfDuplexCapsLock = false
halfDuplexNumLock = false
halfDuplexScrollLock = false
xtestIsXineramaUnaware = false
switchCorners = right
switchCornerSize = 40
ash:
halfDuplexCapsLock = false
halfDuplexNumLock = false
halfDuplexScrollLock = false
xtestIsXineramaUnaware = false
switchCorners = left
switchCornerSize = 40
end
section: aliases
end
section: links
multivac:
right = ash
ash:
left = multivac
end
section: options
heartbeat = 5000
relativeMouseMoves = false
screenSaverSync = true
win32KeepForeground = false
# hotkey to lock the cursor to the screen:
keystroke(CapsLock) = lockCursorToScreen(toggle)
end