Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(tray): open today's journal note
Elian Doran84edf0348f84
diff --git a/src/public/app/desktop.ts b/src/public/app/desktop.tsindex e6eca440da..4e9930d34c 100644--- a/src/public/app/desktop.ts+++ b/src/public/app/desktop.ts@@ -48,6 +48,7 @@ if (utils.isElectron()) {function initOnElectron() {const electron: typeof Electron = utils.dynamicRequire("electron");electron.ipcRenderer.on("globalShortcut", async (event, actionName) => appContext.triggerCommand(actionName));+ electron.ipcRenderer.on("openInSameTab", async (event, noteId) => appContext.tabManager.openInSameTab(noteId));const electronRemote: typeof ElectronRemote = utils.dynamicRequire("@electron/remote");const currentWindow = electronRemote.getCurrentWindow();const style = window.getComputedStyle(document.body);diff --git a/src/services/tray.ts b/src/services/tray.tsindex 5b882dcadc..992d67053b 100644--- a/src/services/tray.ts+++ b/src/services/tray.ts@@ -4,6 +4,8 @@ import windowService from "./window.js";import optionService from "./options.js";import { fileURLToPath } from "url";import type { KeyboardActionNames } from "./keyboard_actions_interface.js";+import date_notes from "./date_notes.js";+import type BNote from "../becca/entities/bnote.js";let tray: Tray;// `mainWindow.isVisible` doesn't work with `mainWindow.show` and `mainWindow.hide` - it returns `false` when the window@@ -58,12 +60,21 @@ function updateTrayMenu() {mainWindow?.webContents.send("globalShortcut", actionName);}+ function openInSameTab(note: BNote) {+ mainWindow?.webContents.send("openInSameTab", note.noteId);+ }+const contextMenu = Menu.buildFromTemplate([{label: "New Note",type: "normal",click: () => triggerKeyboardAction("createNoteIntoInbox")},+ {+ label: "Open today's journal note",+ type: "normal",+ click: () => openInSameTab(date_notes.getTodayNote())+ },{ type: "separator" },{label: isVisible ? "Hide" : "Show",