Skip to content

Build your personal knowledge base with Trilium Notes

feat: add command openTodayNote with empty keyboard shortcut #7472

contributor5620e7f4a7a0
diff --git a/apps/client/src/components/entrypoints.ts b/apps/client/src/components/entrypoints.ts
index 7989960a6b..9194596ab5 100644
--- a/apps/client/src/components/entrypoints.ts
+++ b/apps/client/src/components/entrypoints.ts
@@ -159,6 +159,16 @@ export default class Entrypoints extends Component {
this.openInWindowCommand({ notePath: "", hoistedNoteId: "root" });
}
+ async openTodayNoteCommand() {
+ const todayNote = await dateNoteService.getTodayNote();
+ if (!todayNote) {
+ console.warn("Missing today note.");
+ return;
+ }
+
+ await appContext.tabManager.openTabWithNoteWithHoisting(todayNote.noteId, { activate: true });
+ }
+
async runActiveNoteCommand() {
const noteContext = appContext.tabManager.getActiveContext();
if (!noteContext) {
diff --git a/apps/server/src/services/keyboard_actions.ts b/apps/server/src/services/keyboard_actions.ts
index 6a11242c47..0903179a6a 100644
--- a/apps/server/src/services/keyboard_actions.ts
+++ b/apps/server/src/services/keyboard_actions.ts
@@ -319,6 +319,14 @@ function getDefaultKeyboardActions() {
description: t("keyboard_actions.open-new-window"),
scope: "window"
},
+ {
+ actionName: "openTodayNote",
+ friendlyName: t("keyboard_action_names.open-today-note"),
+ iconClass: "bx bx-calendar",
+ defaultShortcuts: [],
+ description: t("keyboard_actions.open-today-note"),
+ scope: "window"
+ },
{
actionName: "toggleTray",
friendlyName: t("keyboard_action_names.toggle-system-tray-icon"),
diff --git a/packages/commons/src/lib/keyboard_actions_interface.ts b/packages/commons/src/lib/keyboard_actions_interface.ts
index c3de7e0dbb..ce2defcd63 100644
--- a/packages/commons/src/lib/keyboard_actions_interface.ts
+++ b/packages/commons/src/lib/keyboard_actions_interface.ts
@@ -35,6 +35,7 @@ const enum KeyboardActionNamesEnum {
activateNextTab,
activatePreviousTab,
openNewWindow,
+ openTodayNote,
toggleTray,
toggleZenMode,
firstTab,