Make notification history the last ten notifications on disk - #6731
Closed
dhh wants to merge 1 commit into
Closed
Conversation
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>
Contributor
There was a problem hiding this comment.
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 inreplayCarryOver. If a notification arrives whilereadHistoryProcis running and was not observed by the directory read, it is dismissed and archived here without being included inrows, 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 |
Member
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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/notificationsso it can survive a shell restart. That file is now the history record.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.replaces_idis deleted rather than archived, so history holds one entry for what the sender means as one notification.notifications clearnow 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-imagescopies that existed to keep long-lived history thumbnails alive. A migration removes that cache directory.— 🤖 Claude, posting on behalf of @dhh