diff --git a/README.md b/README.md index 54b0781..1a357b2 100644 --- a/README.md +++ b/README.md @@ -223,6 +223,17 @@ To do so, add `--daemon` to the commandline args: $ cargo run --release -- --daemon ``` +In order to start lan-mouse with a graphical session automatically, +the [systemd-service](service/lan-mouse.service) can be used: + +Copy the file to `~/.config/systemd/user/` and enable the service: + +```sh +cp service/lan-mouse.service ~/.config/systemd/user +systemctl --user daemon-reload +systemctl --user enable --now lan-mouse.service +``` + ## Configuration To automatically load clients on startup, the file `$XDG_CONFIG_HOME/lan-mouse/config.toml` is parsed. `$XDG_CONFIG_HOME` defaults to `~/.config/`. diff --git a/service/lan-mouse.service b/service/lan-mouse.service new file mode 100644 index 0000000..4b1e6f4 --- /dev/null +++ b/service/lan-mouse.service @@ -0,0 +1,13 @@ +[Unit] +Description=Lan Mouse +# lan mouse needs an active graphical session +After=graphical-session.target +# make sure the service terminates with the graphical session +BindsTo=graphical-session.target + +[Service] +ExecStart=/usr/bin/lan-mouse --daemon +Restart=on-failure + +[Install] +WantedBy=graphical-session.target