Jump to content

Ubuntu 16.04 - Start synergy before login


Rafael A. Baragano

Recommended Posts

Rafael A. Baragano
Posted

Could someone please create a tutorial on how to do this. I cannot use the server's mouse/keyboard on login, which is kind of annoying.

 

I know it is possible, but how?

 

Thanks in advance...

Alex Copeland
Posted

I haven't been able to get synergy pre-login on Linux to work in some time. You used to be able to add commands the desktop startup scripts, but it hasn't worked for me with lightdm or gdm on later arch, fedora or ubuntu versions.

 

I don't know if this will work for you, but I stopped messing with trying to get synergy to start with the desktop manager and did the following:

 

1. set synergy to autostart with my session

2. set the screen to lock immediately on login (I use slock)

3. set my user to autologin

 

Then you can use the synergy server to unlock and use the session.

  • 2 weeks later...
Alex Copeland
Posted

I messed around with this today. If you're using lightdm (I think that's default for newer Ubuntu releases), you can do the following.

Make a script to start synergy and make a script to stop synergy. Tell lightdm to run the scripts by editing the lines in /etc/lightdm/lightdm.conf:

#display-setup-script=
#session-setup-script=

to

display-setup-script=/usr/local/bin/display-setup.sh
session-setup-script=/usr/local/bin/display-stopped.sh

Basically, you tell lightdm to start synergc as root for the login then kill synergy as root when it sets up the user session after login.

As root...

Make a couple of scripts:

h=
# Start synergyc
echo "/usr/bin/synergyc $h" > /usr/local/bin/loginstart.sh
# killall synergyc but don't error if it's not running
echo "killall synergyc || true" > /usr/local/bin/loginstop.sh

 

Edit /etc/lightdm/lightdm.conf

sed -i -e '/^#display-setup-script=/display-setup-script=\/usr\/local\/bin\/loginstart.sh/' /etc/lightdm/lightdm.conf -e 's/^#session-setup-script=/session-setup-script=\/usr\/local\/bin\/loginstop.sh/' /etc/lightdm/lightdm.conf 

 

See https://wiki.ubuntu.com/LightDM

  • 2 weeks later...
  • 9 months later...
Posted

Thank you Alex Copeland for you post, it helped me a lot.

In addition, there are some other changes were required in my setup with Lubuntu 16.04

I'll replicate steps mentioned by Alex and add the missing steps for my case.

# Run everything as ROOT user
# copy the current synergy SSL configuration to root user
# synergy should be already up and run, configured etc..
cp -R ~/.synergy /root/

# create /etc/lightdm/lightdm.conf.d/synergyc.conf
echo "[SeatDefaults]\ndisplay-setup-script=/usr/local/bin/loginstart.sh\nsession-setup-script=/usr/local/bin/loginstop.sh\n" > /etc/lightdm/lightdm.conf.d/synergyc.conf

# create /usr/local/bin/loginstart.sh
echo "/usr/bin/synergyc -f --no-tray --debug INFO --log /var/log/synergy-start.log --name <your pc name> --enable-crypto <your server ip>:24800 || true &" > /usr/local/bin/loginstart.sh
chmod +x /usr/local/bin/loginstart.sh

# create /usr/local/bin/loginstop.sh
echo "killall synergyc || true" > /usr/local/bin/loginstop.sh
chmod +x /usr/local/bin/loginstop.sh

 

Alex Copeland
Posted

And, thank you, Kostanos.  Your post helped me out, too.

I typically run Arch, and the default config doesn't include the /etc/lightdm/lightdm.conf.d/ directory.  When I looked at the Arch docs, I missed reference to the conf.d -- if there was one.

The way you did things using the conf.d instead of messing with the lightdm.conf file is a lot cleaner.

Posted

synergy 2 has autostart, you should have it available in your downloads, if you are running a non supported distros check things like the AUR or extract the files yourself and put them in the right place.

Posted
1 hour ago, jaap aarts said:

synergy 2 has autostart, you should have it available in your downloads, if you are running a non supported distros check things like the AUR or extract the files yourself and put them in the right place.

What exactly do you mean by Synergy 2? The current downloadable version seems to be Synergy 1.8.

  • 1 year later...
Posted

The complexity for such a simple task is truly astounding.

I am using Synergy v1.8.8.  If anyone has any ideas on how to get this to autostart on ubuntu 18.04 without overhauling my OS, please let me know.

Posted
On 1/24/2019 at 8:30 PM, Alex Copeland said:

@Steve3PO  If you just want it to autostart after you log into your session, the task is a lot simpler.  

Add


synergys

or


synergyc <server>

to your startup applications. https://websiteforstudents.com/set-apps-to-auto-startup-at-logon-on-ubuntu-17-10-18-04/

I don't use the GUI, but I think that it may have an option to start on login as well.

I tried the client version and it's not working for me on Ubuntu 18.04.1

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...