add systemd user service definition

ref #76
ref #49
This commit is contained in:
Ferdinand Schober
2024-01-21 20:39:07 +01:00
parent e5b770a799
commit 006831b9f1
2 changed files with 24 additions and 0 deletions

View File

@@ -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/`.

13
service/lan-mouse.service Normal file
View File

@@ -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