Skip to content

Build your personal knowledge base with Trilium Notes

fix(notes): support workspace calendar root for inbox captures

Jakob Schlanstedt075c9335c0b5
diff --git a/docs/User Guide/User Guide/Basic Concepts and Features/Navigation/Jump to & command palette.md b/docs/User Guide/User Guide/Basic Concepts and Features/Navigation/Jump to & command palette.md
index f29b7e3a8b..1a3db1718e 100644
--- a/docs/User Guide/User Guide/Basic Concepts and Features/Navigation/Jump to & command palette.md
+++ b/docs/User Guide/User Guide/Basic Concepts and Features/Navigation/Jump to & command palette.md
@@ -17,7 +17,7 @@ In addition to searching for notes, it is also possible to search for commands.
* By default, when there is no text entered it will display the most recent notes.
* Using the keyboard, use the up or down arrow keys to navigate between items. Press <kbd>Enter</kbd> to open the desired note.
* If the note doesn't exist, it's possible to create it by typing the desired note title and selecting one of two options:
- * _Create note_ places it in the <a class="reference-link" href="../Notes/Note%20Inbox.md">Note Inbox</a>: the note labelled `#inbox`, today's <a class="reference-link" href="../../Advanced%20Usage/Advanced%20Showcases/Day%20Notes.md">Day Notes</a> if there is none, or the top level if there is no journal either. While hoisted into a <a class="reference-link" href="Workspaces.md">Workspaces</a>, the workspace's own inbox is used, falling back to the workspace root itself. The option names the destination, so it is always visible before the note is created.
+ * _Create note_ places it in the <a class="reference-link" href="../Notes/Note%20Inbox.md">Note Inbox</a>: the note labelled `#inbox`, today's <a class="reference-link" href="../../Advanced%20Usage/Advanced%20Showcases/Day%20Notes.md">Day Notes</a> if there is none, or the top level if there is no journal either. While hoisted into a <a class="reference-link" href="Workspaces.md">Workspaces</a>, the workspace's own inbox is used, then today's day note if the workspace has a `#workspaceCalendarRoot`, otherwise the workspace root itself. The option names the destination, so it is always visible before the note is created.
* _Create child note_ places it under the note that is currently open.
## Recent notes
diff --git a/docs/User Guide/User Guide/Basic Concepts and Features/Notes/Note Inbox.md b/docs/User Guide/User Guide/Basic Concepts and Features/Notes/Note Inbox.md
index 07e5ca020a..5c8a5f933c 100644
--- a/docs/User Guide/User Guide/Basic Concepts and Features/Notes/Note Inbox.md
+++ b/docs/User Guide/User Guide/Basic Concepts and Features/Notes/Note Inbox.md
@@ -26,4 +26,5 @@ When a new note is created while hoisted in a workspace, the location is determi
* A note carrying the `#workspaceInbox` label in that workspace.
* A note carrying the `#inbox` within that workspace.
+* Today's [day note](../../Advanced%20Usage/Advanced%20Showcases/Day%20Notes.md), if the workspace has a `#workspaceCalendarRoot`.
* The workspace root note itself.
\ No newline at end of file
diff --git a/packages/trilium-core/src/services/special_notes.spec.ts b/packages/trilium-core/src/services/special_notes.spec.ts
index 5ff5efaf49..84ed7a1130 100644
--- a/packages/trilium-core/src/services/special_notes.spec.ts
+++ b/packages/trilium-core/src/services/special_notes.spec.ts
@@ -189,6 +189,39 @@ describe("special_notes (core, real DB)", () => {
const result = specialNotes.getInboxNote("2026-05-29");
expect(result).toBe(workspace);
});
+
+ it("places a capture under the workspace calendar when hoisted into that workspace", () => {
+ const { workspace, calendar } = getContext().init(() => {
+ const workspace = noteService.createNewNote({
+ parentNoteId: "root",
+ title: "workspace-for-inbox-calendar",
+ content: "",
+ type: "text"
+ }).note;
+ workspace.setLabel("workspace");
+
+ const calendar = noteService.createNewNote({
+ parentNoteId: workspace.noteId,
+ title: "workspace-journal",
+ content: "",
+ type: "text"
+ }).note;
+ calendar.setLabel("workspaceCalendarRoot");
+
+ return { workspace, calendar };
+ });
+
+ getContext().init(() => {
+ getContext().set("hoistedNoteId", workspace.noteId);
+
+ expect(specialNotes.getInboxTarget()).toMatchObject({ kind: "dayNote" });
+
+ const inbox = specialNotes.getInboxNote("2026-09-15");
+ expect(inbox.hasAncestor(calendar.noteId)).toBe(true);
+ expect(inbox.getParentNotes().some((parent) => parent.noteId === workspace.noteId))
+ .toBe(false);
+ });
+ });
});
describe("getInboxTarget", () => {
@@ -225,7 +258,7 @@ describe("special_notes (core, real DB)", () => {
expect(Object.keys(becca.notes).length).toBe(noteCountBefore);
});
- it("distinguishes the workspace inbox, a plain inbox and the workspace root", () => {
+ it("distinguishes the workspace inbox, a plain inbox, the workspace calendar and the workspace root", () => {
const workspaceInbox = becca.getNoteOrThrow("root").getChildNotes()[0];
const plainInbox = becca.getNoteOrThrow("root").getChildNotes()[1];
@@ -240,6 +273,12 @@ describe("special_notes (core, real DB)", () => {
const withNeither = makeWorkspaceStub({});
vi.spyOn(hoistedNoteService, "getWorkspaceNote").mockReturnValue(withNeither as any);
expect(specialNotes.getInboxTarget()).toMatchObject({ kind: "workspaceRoot", noteId: withNeither.noteId });
+
+ const withCalendar = makeWorkspaceStub({
+ "#workspaceCalendarRoot": becca.getNoteOrThrow("root").getChildNotes()[0]
+ });
+ vi.spyOn(hoistedNoteService, "getWorkspaceNote").mockReturnValue(withCalendar as any);
+ expect(specialNotes.getInboxTarget()).toMatchObject({ kind: "dayNote" });
});
});
diff --git a/packages/trilium-core/src/services/special_notes.ts b/packages/trilium-core/src/services/special_notes.ts
index f0b3d7f610..f5179d9c88 100644
--- a/packages/trilium-core/src/services/special_notes.ts
+++ b/packages/trilium-core/src/services/special_notes.ts
@@ -42,6 +42,11 @@ function resolveInboxTarget(): { kind: InboxTargetKind; note?: BNote } {
return { kind: "inbox", note: inbox };
}
+ // Capture into today's note when this workspace has its own journal.
+ if (workspaceNote.searchNoteInSubtree("#workspaceCalendarRoot")) {
+ return { kind: "dayNote" };
+ }
+
return { kind: "workspaceRoot", note: workspaceNote };
}