mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 10:02:59 +08:00
feat(tray): open today's journal note
This commit is contained in:
parent
4b1cbca76d
commit
84edf0348f
@ -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);
|
||||
|
@ -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",
|
||||
|
Loading…
x
Reference in New Issue
Block a user