I used to run Synergy via an Upstart script that included:start on (login-session-start          ...          or drm-device-added          or drm-device-changed          or drm-device-removed          or graphics-device-added          or graphics-device-changed          or graphics-device-removed          ...)stop on (drm-device-added         or drm-device-changed         or drm-device-removed         or graphics-device-added         or graphics-device-changed         or graphics-device-removed         ...)This would stop and start the service if eg. a monitor was connected or disconnected so that Synergy would detect the new configuration.I am writing Systemd service files for Synergy, but I can't find what an equivalent mechanism would be. man systemd.special doesn't list any graphics related targets, systemctl list-units --type=device only shows the graphics adapter (not the monitor) and it's not clear to me how to get Systemd to stop and start a service on a particular event.How can I do these things? I'm writing it on Ubuntu 16.04, but the more distro agnostic the answer, the better.
How can I restart a systemd service on graphics changes?
systemd