Keyboard shortcut for today note button (#7549)

This commit is contained in:
Elian Doran 2025-11-01 16:17:24 +02:00 committed by GitHub
commit 19c6ae6fe5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 20 additions and 0 deletions

View File

@ -270,6 +270,7 @@ export type CommandMappings = {
closeThisNoteSplit: CommandData; closeThisNoteSplit: CommandData;
moveThisNoteSplit: CommandData & { isMovingLeft: boolean }; moveThisNoteSplit: CommandData & { isMovingLeft: boolean };
jumpToNote: CommandData; jumpToNote: CommandData;
openTodayNote: CommandData;
commandPalette: CommandData; commandPalette: CommandData;
// Keyboard shortcuts // Keyboard shortcuts

View File

@ -159,6 +159,16 @@ export default class Entrypoints extends Component {
this.openInWindowCommand({ notePath: "", hoistedNoteId: "root" }); this.openInWindowCommand({ notePath: "", hoistedNoteId: "root" });
} }
async openTodayNoteCommand() {
const todayNote = await dateNoteService.getTodayNote();
if (!todayNote) {
console.warn("Missing today note.");
return;
}
await appContext.tabManager.openInSameTab(todayNote.noteId);
}
async runActiveNoteCommand() { async runActiveNoteCommand() {
const noteContext = appContext.tabManager.getActiveContext(); const noteContext = appContext.tabManager.getActiveContext();
if (!noteContext) { if (!noteContext) {

View File

@ -41,6 +41,14 @@ function getDefaultKeyboardActions() {
scope: "window", scope: "window",
ignoreFromCommandPalette: true ignoreFromCommandPalette: true
}, },
{
actionName: "openTodayNote",
friendlyName: t("hidden-subtree.open-today-journal-note-title"),
iconClass: "bx bx-calendar",
defaultShortcuts: [],
description: t("hidden-subtree.open-today-journal-note-title"),
scope: "window"
},
{ {
actionName: "commandPalette", actionName: "commandPalette",
friendlyName: t("keyboard_action_names.command-palette"), friendlyName: t("keyboard_action_names.command-palette"),

View File

@ -35,6 +35,7 @@ const enum KeyboardActionNamesEnum {
activateNextTab, activateNextTab,
activatePreviousTab, activatePreviousTab,
openNewWindow, openNewWindow,
openTodayNote,
toggleTray, toggleTray,
toggleZenMode, toggleZenMode,
firstTab, firstTab,