Skip to content

Commit 19c6ae6

Browse files
authored
Keyboard shortcut for today note button (#7549)
2 parents bf0761a + 9c791df commit 19c6ae6

File tree

4 files changed

+20
-0
lines changed

4 files changed

+20
-0
lines changed

apps/client/src/components/app_context.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ export type CommandMappings = {
270270
closeThisNoteSplit: CommandData;
271271
moveThisNoteSplit: CommandData & { isMovingLeft: boolean };
272272
jumpToNote: CommandData;
273+
openTodayNote: CommandData;
273274
commandPalette: CommandData;
274275

275276
// Keyboard shortcuts

apps/client/src/components/entrypoints.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,16 @@ export default class Entrypoints extends Component {
159159
this.openInWindowCommand({ notePath: "", hoistedNoteId: "root" });
160160
}
161161

162+
async openTodayNoteCommand() {
163+
const todayNote = await dateNoteService.getTodayNote();
164+
if (!todayNote) {
165+
console.warn("Missing today note.");
166+
return;
167+
}
168+
169+
await appContext.tabManager.openInSameTab(todayNote.noteId);
170+
}
171+
162172
async runActiveNoteCommand() {
163173
const noteContext = appContext.tabManager.getActiveContext();
164174
if (!noteContext) {

apps/server/src/services/keyboard_actions.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ function getDefaultKeyboardActions() {
4141
scope: "window",
4242
ignoreFromCommandPalette: true
4343
},
44+
{
45+
actionName: "openTodayNote",
46+
friendlyName: t("hidden-subtree.open-today-journal-note-title"),
47+
iconClass: "bx bx-calendar",
48+
defaultShortcuts: [],
49+
description: t("hidden-subtree.open-today-journal-note-title"),
50+
scope: "window"
51+
},
4452
{
4553
actionName: "commandPalette",
4654
friendlyName: t("keyboard_action_names.command-palette"),

packages/commons/src/lib/keyboard_actions_interface.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ const enum KeyboardActionNamesEnum {
3535
activateNextTab,
3636
activatePreviousTab,
3737
openNewWindow,
38+
openTodayNote,
3839
toggleTray,
3940
toggleZenMode,
4041
firstTab,

0 commit comments

Comments
 (0)