From 6d2ad488d26351e4a957c757dd99a5e2bb7b02c5 Mon Sep 17 00:00:00 2001 From: TomiEckert Date: Sat, 28 Feb 2026 12:49:15 +0100 Subject: [PATCH] feat: Add systemd user service for automatic daemon startup and update installation instructions. --- README.md | 1 + docs/STRUCTURE.md | 1 + install.sh | 7 +++++++ toak.service | 12 ++++++++++++ 4 files changed, 21 insertions(+) create mode 100644 toak.service diff --git a/README.md b/README.md index c8bcdf5..9525ef3 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,7 @@ The script will: 1. Publish the project as a **Native AOT** Release binary. 2. Install the executable to `/usr/bin/toak`. 3. Install **Zsh completions** to `/usr/share/zsh/site-functions/`. +4. Install and enable the `toak.service` systemd user service so the background daemon runs automatically. --- diff --git a/docs/STRUCTURE.md b/docs/STRUCTURE.md index 7889ad4..a450261 100644 --- a/docs/STRUCTURE.md +++ b/docs/STRUCTURE.md @@ -39,6 +39,7 @@ Toak/ ├── Serialization/ │ └── AppJsonSerializerContext.cs # System.Text.Json source generation context for AOT support ├── docs/ # Documentation +├── toak.service # systemd user service file to run the daemon automatically └── Program.cs # Application entry point using System.CommandLine ``` diff --git a/install.sh b/install.sh index 408e7f6..9f04dd5 100755 --- a/install.sh +++ b/install.sh @@ -14,5 +14,12 @@ if [ -d "/usr/share/zsh/site-functions" ]; then sudo cp _toak /usr/share/zsh/site-functions/_toak fi +echo "Installing and starting systemd user service..." +sudo mkdir -p ~/.config/systemd/user +sudo cp toak.service ~/.config/systemd/user/ +sudo systemctl --user daemon-reload +sudo systemctl --user enable --now toak.service + echo "Installation complete! You can now run 'toak' from anywhere." echo "Note: You may need to restart your zsh shell or run 'autoload -Uz compinit && compinit' to enable completions." +echo "The Toak daemon is running in the background." diff --git a/toak.service b/toak.service new file mode 100644 index 0000000..e062f34 --- /dev/null +++ b/toak.service @@ -0,0 +1,12 @@ +[Unit] +Description=Toak Dictation Daemon +After=network.target + +[Service] +Type=simple +ExecStart=/usr/bin/toak daemon +Restart=always +RestartSec=3 + +[Install] +WantedBy=default.target