Make notification history the last ten notifications on disk

History was a pair of in-memory lists mirrored into notifications.json, split
into "pending" and "past" by a seen/unseen distinction no surface exposed,
capped at 100, deduped by an id that repeats across server generations, and
pruned by a 15-minute TTL. Replaying it showed five rows drawn from whichever
list happened to hold them.

Every toast already writes a file under ~/.local/state/omarchy/notifications
so it can survive a shell restart. That file is now the history record: when
the popup leaves the screen it moves into notifications/history instead of
being deleted, the newest ten are kept, and showHistory replays exactly what
is in there, including the toasts still on screen when it is asked for. A
notification DND silenced is written straight into the same directory, since
a toast that never showed is the one worth looking back at.

That leaves the models, notifications.json history payload, past pruning, and
the /tmp image cache that existed to keep century-old history thumbnails alive
with nothing to do, so they go.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
David Heinemeier Hansson
2026-08-12 00:58:14 -07:00
co-authored by Claude Opus 5
parent d6b21f8075
commit ab57ad65fd
4 changed files with 368 additions and 644 deletions
+10
View File
@@ -0,0 +1,10 @@
echo "Drop the retired notification image cache"
# Notification history used to be a pair of long-lived lists in
# notifications.json, and thumbnails for it were copied out of /tmp into this
# cache so they would outlive the screenshot they came from. History is now the
# last ten notification files under ~/.local/state/omarchy/notifications/history,
# which reference their image where it already lives, so nothing writes or reads
# this directory anymore.
rm -rf "$HOME/.cache/omarchy/notification-images"