aboutsummaryrefslogtreecommitdiffstats
path: root/mail-overview/README.md
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-09-13 14:02:05 +0200
committerDanilo M. <danix@danix.xyz>2026-09-13 14:02:05 +0200
commit9fc6ca0d9a9cdba9d5808951ce290e559a9e8554 (patch)
treefab4f7bb606b38efaf00e22937c3c5a0f5cc0f57 /mail-overview/README.md
parent87cd101eb3c55d0ad7e8f2142fcce90865da7d39 (diff)
downloadquickshell-9fc6ca0d9a9cdba9d5808951ce290e559a9e8554.tar.gz
quickshell-9fc6ca0d9a9cdba9d5808951ce290e559a9e8554.zip
feat(mail-overview): show mail-watcher health in the drawer
The watcher already writes ~/.local/state/mail-watcher.heartbeat every 60s, so the drawer reads it and shows a dot: green when idling, yellow when a folder gave up, red when the heartbeat is stale or missing. Backoff stays green because it is normal recovery and the watcher's own health check treats it that way. The staleness rule is reimplemented in a few lines rather than shelling out to --status; the heartbeat file is the documented cheap-to-poll surface. Read once per open rather than watched: the heartbeat is written by atomic replace, so an inotify watch held on the old inode dies with it. "Sync now" is removed with its Process. The watcher triggers syncs, the cron tick is the backstop, and waybar's right-click still runs mailsync.sh.
Diffstat (limited to 'mail-overview/README.md')
-rw-r--r--mail-overview/README.md36
1 files changed, 33 insertions, 3 deletions
diff --git a/mail-overview/README.md b/mail-overview/README.md
index daf2bf9..68ad051 100644
--- a/mail-overview/README.md
+++ b/mail-overview/README.md
@@ -16,7 +16,9 @@ Clicking the icon opens the drawer; Escape or a click outside closes it.
│ ● Account D 0 │
│ ● Account E 0 │
├──────────────────────────────────────────────────┤
- │ [Sync now] [Open qtmaildir] │
+ │ ● watcher ok · 25 folders │
+ ├──────────────────────────────────────────────────┤
+ │ [Open qtmaildir] │
└──────────────────────────────────────────────────┘
## Running it
@@ -145,8 +147,36 @@ open. `startup_account` in its config is a static setting, not a flag, so
here was rejected rather than deferred: it would write the database behind a
possibly running client.
-"Sync now" runs `~/bin/mailsync.sh`, which is already lock-protected against a
-concurrent cron run, and the watcher picks up whatever it commits.
+"Open qtmaildir" launches the client. There is no "Sync now" button: the
+watcher triggers a sync the moment mail lands, the cron tick is the backstop,
+and `on-click-right` on the waybar module runs `~/bin/mailsync.sh` for a manual
+pull.
+
+## The watcher status dot
+
+Below the accounts, above the button, a coloured dot reports whether
+`mail-watcher` is alive and sane, read from its heartbeat at
+`~/.local/state/mail-watcher.heartbeat`:
+
+- **green** (`watcher ok · N folders`) heartbeat fresh, no dead threads.
+- **yellow** (`N folder(s) dead, check the log`) heartbeat fresh, but a folder
+ gave up permanently.
+- **red** (`watcher not running`) heartbeat missing, unparseable, or older than
+ 300s.
+
+Backoff never turns the dot: it is normal recovery from a dropped IDLE
+connection, and the watcher's own health check treats it as healthy. The
+staleness rule is the same one `mail-watcher` uses (`heartbeat_is_healthy`),
+reimplemented here in a few lines rather than shelling out to
+`mail-watcher.py --status` on every open.
+
+The heartbeat is read once per open. The drawer is a `LazyLoader`, so closing
+and reopening rebuilds the `FileView` and reads the file current. A file watch
+is deliberately not used: the heartbeat is written by atomic replace (tmpfile
+then rename), so an inotify watch held on the old inode dies with it, which is
+the same trap as watching a file inside the Xapian directory. The cost is that
+a drawer left open does not update until reopened, which for 60s heartbeat data
+is not worth a timer.
## Theme and blur