fix(statusline): render the althing monitor bell reliably
Two gaps kept the 🔔/🔕 monitor-armed indicator from ever showing: 1. The block keyed off $ALTHING_HANDLE, which is unset in the statusline environment — so the handle was always empty and the whole bell block was skipped. Resolve the per-project handle from ~/.althing/session_handles.json (keyed by the cwd Claude Code passes on stdin), the same map `althing-cli use` writes. 2. Even with the handle resolved, the lock check covered only wake-listener-$h.lock and light-monitor-$h.lock — missing monitor-$h.lock, which is the lock `althing-cli monitor` (the CC-native exit-0-re-arm loop) actually writes. Add it; the kill -0 liveness gate already discards stale locks.
This commit is contained in:
@@ -110,9 +110,18 @@ if command -v althing-cli >/dev/null 2>&1; then
|
||||
# suppress the empty-inbox form (📪 0) — only surface actual unread mail (📬 N)
|
||||
case "$althing" in *📪*) althing="" ;; esac
|
||||
h="${ALTHING_HANDLE:-}"
|
||||
# ALTHING_HANDLE isn't set in the statusline env — resolve the per-project handle from
|
||||
# althing's session map (keyed by the cwd Claude Code passes on stdin), the same source
|
||||
# `althing-cli use` writes. Without this the monitor bell (🔔/🔕) never renders.
|
||||
[ -z "$h" ] && [ -n "$cwd" ] && h=$(jq -r --arg d "$cwd" '.[$d] // empty' "$HOME/.althing/session_handles.json" 2>/dev/null)
|
||||
if [ -n "$h" ]; then
|
||||
mon="🔕"
|
||||
for lk in "$HOME/.althing/wake-listener-$h.lock" "$HOME/.althing/light-monitor-$h.lock"; do
|
||||
# Three independent arming mechanisms, one lock each — any live one means "armed":
|
||||
# monitor-$h.lock <- `althing-cli monitor` (the CC-native exit-0-re-arm loop)
|
||||
# wake-listener-$h.lock <- `althing-wake-listener` (herald inbound)
|
||||
# light-monitor-$h.lock <- `althing-light-monitor` (standing watch)
|
||||
# The kill -0 liveness gate below discards stale locks, so listing all three is safe.
|
||||
for lk in "$HOME/.althing/monitor-$h.lock" "$HOME/.althing/wake-listener-$h.lock" "$HOME/.althing/light-monitor-$h.lock"; do
|
||||
[ -f "$lk" ] || continue
|
||||
pid=$(tr -dc '0-9' < "$lk" 2>/dev/null)
|
||||
if [ -n "$pid" ] && kill -0 "$pid" 2>/dev/null; then mon="🔔"; break; fi
|
||||
|
||||
Reference in New Issue
Block a user