Skip to content

Make notification history the last ten notifications on disk - #6731

Closed
dhh wants to merge 1 commit into
quattrofrom
notification-history-on-disk
Closed

Make notification history the last ten notifications on disk#6731
dhh wants to merge 1 commit into
quattrofrom
notification-history-on-disk

Conversation

@dhh

@dhh dhh commented Aug 12, 2026

Copy link
Copy Markdown
Member

The notification 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.

  • A popup leaving the screen — expired, dismissed, or clicked — moves into notifications/history/ instead of being deleted, and the directory is trimmed to the newest ten in the same shell job.
  • showHistory (SUPER + SHIFT + ALT + comma) replays exactly what is in there, plus the toasts still on screen when it was asked for, newest first.
  • A notification DND silenced is written straight into the same directory: a toast that never showed is the one worth looking back at.
  • A notification superseded on screen through replaces_id is deleted rather than archived, so history holds one entry for what the sender means as one notification.
  • notifications clear now forgets the recorded history instead of emptying a "past" bucket that nothing displayed.

Gone with it: the pending/past models, the history payload in notifications.json (which keeps only {version, dnd} and rewrites itself once on load if it still carries the old rows), the past pruning, and the ~/.cache/omarchy/notification-images copies that existed to keep long-lived history thumbnails alive. A migration removes that cache directory.

— 🤖 Claude, posting on behalf of @dhh

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>
Copilot AI balanced review requested due to automatic review settings August 12, 2026 07:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Moves notification history from in-memory models to the ten newest persisted notification files.

Changes:

  • Archives dismissed, expired, clicked, and DND-silenced notifications on disk.
  • Replays archived and currently visible notifications newest-first.
  • Removes legacy history models, image caching, and cached images.

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
shell/plugins/notifications/Service.qml Implements disk-backed history and replay.
shell/plugins/notifications/NotificationLogic.js Parses settings and constructs replay rows.
test/shell.d/notifications-test.sh Updates notification-history tests.
migrations/1786517850.sh Removes the retired image cache.
Suppressed comments (1)

shell/plugins/notifications/Service.qml:499

  • clearPopups() removes the model's current contents, not only the rows captured in replayCarryOver. If a notification arrives while readHistoryProc is running and was not observed by the directory read, it is dismissed and archived here without being included in rows, so opening history can make a fresh toast disappear. Preserve popups that arrived after the request or merge the completion-time live rows before clearing.
    clearPopups()

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +443 to +446
service.replayCarryOver = liveRowsForReplay()
readHistoryProc.command = ["bash", "-c",
"awk 1 \"$1\"/*.json 2>/dev/null || true", "--", historyDir]
readHistoryProc.running = true
@dhh

dhh commented Aug 12, 2026

Copy link
Copy Markdown
Member Author

Landed on quattro directly as ab57ad6 — closing this in favour of the commit that shipped.

— 🤖 Claude, posting on behalf of @dhh

@dhh dhh closed this Aug 12, 2026
@dhh
dhh deleted the notification-history-on-disk branch August 12, 2026 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants