How to obtain recent_notes to achieve the system menu bar effect. #9368
Replies: 1 comment
|
To show "recent notes" in the right-hand toolbar (like the "recent changes" panel), you should use a custom script/widget rather than bookmarks. Trilium tracks recent notes in its database and exposes them via the backend API. You can access this data in a backend script using the Becca API and the BRecentNote class, similar to how the system menu bar and tray menu work. For example, you can query recent notes with something like: const recentNotes = becca.getRecentNotesFromQuery(`
SELECT recent_notes.*
FROM recent_notes
JOIN notes USING(noteId)
WHERE notes.isDeleted = 0
ORDER BY utcDateCreated DESC
LIMIT 10
`);Each To make this appear in the right toolbar, create a backend script note that queries recent notes and renders them as a widget. Label the note with Bookmarks are for quick access to specific notes, but they don't automatically update to show recent notes. For your use case, a script/widget is the way to go. If you need a code template or more step-by-step guidance, let me know! To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Uh oh!
There was an error while loading. Please reload this page.
As shown in the diagram, I want to add the “recent note” from the application menu bar to the right-hand toolbar, similar to the “recent changes” on the right side, achieving the same effect. Should I use a script or a bookmark? If someone can guide me, I don’t know how to implement this feature.
All reactions