From 006831b9f1a2d7195b5b0aaa1119669af7ab4158 Mon Sep 17 00:00:00 2001 From: Ferdinand Schober Date: Sun, 21 Jan 2024 20:39:07 +0100 Subject: [PATCH] add systemd user service definition ref #76 ref #49 --- README.md | 11 +++++++++++ service/lan-mouse.service | 13 +++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 service/lan-mouse.service 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