There are programs that I want to automatically start after a successful graphical desktop login (e.g. to Gnome or Xmonad) and stop when I logout. How can I change the
~/.config/systemd/user/synergys.service file to do the above properly?
Right now with the service enabled, according to
journalctl --user, the service tries to start when I login but fails with
which I think basically means it failed to get a display. When I manually start it after logging in, it's fine. I suspect the service is starting too early, before there's a display, because
WantedBy=default.target is not specific to a GUI login and even a text login will trigger it.
I've experimented with
graphical-session.target but that went nowhere. This is on Ubuntu 20.04.
[Unit] Description=Synergy Server [Service] ExecStart=/usr/bin/synergys --no-daemon --no-tray --address :: --serial-key XXXX --enable-crypto Restart=always RestartSec=3 [Install] WantedBy=default.target
I know I can manually run the program as a desktop session 'startup' program, but this way does not provide automatic retry upon failure.