I'm writing an Upstart job conf for the Synergy client[1]. Synergy basically allows you to share a mouse and keyboard with another PC, and it's useful to have it start up right from the moment there's a graphical login screen. Typically people use lightdm scripts for this, but I think an Upstart job would be more universal and easier to distribute.
I started by getting something that just works on my machine, and it's included below; but a quick look at it will show that it's very fragile, and specific to lightdm. So I'd like some advice on improving it. Specifically: 1. For this to work under lightdm, I need to set XAUTHORITY to '/var/run/lightdm/root/:0'. Is there a better way to do this? Is there a DM independent way to do this, or do I need to detect whether it's running under lightdm, gdm, kdm, etc. and take separate action for each of them? 2. Synergy doesn't detect new devices or changes in resolution, so I make it restart on as many graphics-related events as I can find. Are any of those redundant with each other? Or deprecated? Have I missed any? 3. Slurping the client address from a file in /etc seemed the simplest possible way to get it. Are there problems with this? Of course, feel free to offer criticism on any other aspect of it too. ---- /etc/init/synergyc.conf # Synergy Client # # Starts the synergy client when an X session is up and running. description "Synergy Client" author "Jason Heeris <[email protected]>" 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 or bdi-device-added or bdi-device-changed or bdi-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 or bdi-device-added or bdi-device-changed or bdi-device-removed) env XAUTHORITY=/var/run/lightdm/root/:0 script SYNERGY_HOST_FILE="/etc/synergy/client" if [ -e "${SYNERGY_HOST_FILE}" ]; then CLIENT_ADDR=$(cat "${SYNERGY_HOST_FILE}") exec synergyc -f "${CLIENT_ADDR}" fi end script ---- Cheers, Jason [1] http://synergy-foss.org/ -- ubuntu-devel mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel
