From a04578083f071ee9731e11d2a61f3ae9c548fd81 Mon Sep 17 00:00:00 2001 From: Demmie <2e3s19@gmail.com> Date: Fri, 19 Jul 2024 00:46:08 -0400 Subject: [PATCH] Add systemd sample configs and docs --- README.md | 2 ++ {watchers/service => config}/aw-awatcher.service | 2 +- config/awatcher.service | 16 ++++++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) rename {watchers/service => config}/aw-awatcher.service (88%) create mode 100644 config/awatcher.service diff --git a/README.md b/README.md index abc5c7a..8ad34e5 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ The binaries for the bundle, bundled DEB and ActivityWatch watchers replacement - Remove `aw-watcher-window` and `aw-watcher-afk` from autostart at `aw-qt/aw-qt.toml` in [config directory](https://docs.activitywatch.net/en/latest/directories.html#config), add `aw-awatcher`. - Restart ActivityWatch. In the Modules submenu there should be a new checked module **aw-awatcher**. Note that awatcher shows up in the Web UI under Timeline as `aw-watcher-window_$HOSTNAME`. +- Optionally, you can use systemd instead of ActivityWatch runner. In this case, skip adding `aw-awatcher` to `aw-qt.toml` and install this service [configuration](https://github.com/2e3s/awatcher/blob/main/config/aw-awatcher.service). In this case, ActivityWatch server also must be managed by systemd (as `aw-server.service` in the config). ### Bundle with built-in ActivityWatch @@ -35,6 +36,7 @@ They are controled from the tray, no additional configuration is necessary. It is recommended to use `~/.config/autostart` for the bundle. This folder is employed by "Autostart" in KDE settings and Gnome Tweaks. Systemd may require to sleep for a few seconds (`ExecStartPre=/bin/sleep 5`) in order to wait for the environment. +See this service [configuration](https://github.com/2e3s/awatcher/blob/main/config/awatcher.service). ## Supported environments diff --git a/watchers/service/aw-awatcher.service b/config/aw-awatcher.service similarity index 88% rename from watchers/service/aw-awatcher.service rename to config/aw-awatcher.service index f9c154c..f2413f6 100644 --- a/watchers/service/aw-awatcher.service +++ b/config/aw-awatcher.service @@ -14,4 +14,4 @@ After=aw-server.service graphical-session.target Requires=aw-server.service [Install] -WantedBy=graphical-session.target \ No newline at end of file +WantedBy=graphical-session.target diff --git a/config/awatcher.service b/config/awatcher.service new file mode 100644 index 0000000..0df6dc6 --- /dev/null +++ b/config/awatcher.service @@ -0,0 +1,16 @@ +[Service] +Type=simple +TimeoutStartSec=120 +ExecStartPre=/bin/sleep 5 +ExecStart=awatcher +Restart=always +RestartSec=5 +RestartSteps=2 +RestartMaxDelaySec=15 + +[Unit] +Description=AWatcher +After=graphical-session.target + +[Install] +WantedBy=graphical-session.target