mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-31 21:11:30 +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() { | function initOnElectron() { | ||||||
|     const electron: typeof Electron = utils.dynamicRequire("electron"); |     const electron: typeof Electron = utils.dynamicRequire("electron"); | ||||||
|     electron.ipcRenderer.on("globalShortcut", async (event, actionName) => appContext.triggerCommand(actionName)); |     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 electronRemote: typeof ElectronRemote = utils.dynamicRequire("@electron/remote"); | ||||||
|     const currentWindow = electronRemote.getCurrentWindow(); |     const currentWindow = electronRemote.getCurrentWindow(); | ||||||
|     const style = window.getComputedStyle(document.body); |     const style = window.getComputedStyle(document.body); | ||||||
|  | |||||||
| @ -4,6 +4,8 @@ import windowService from "./window.js"; | |||||||
| import optionService from "./options.js"; | import optionService from "./options.js"; | ||||||
| import { fileURLToPath } from "url"; | import { fileURLToPath } from "url"; | ||||||
| import type { KeyboardActionNames } from "./keyboard_actions_interface.js"; | 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; | let tray: Tray; | ||||||
| // `mainWindow.isVisible` doesn't work with `mainWindow.show` and `mainWindow.hide` - it returns `false` when the window
 | // `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); |         mainWindow?.webContents.send("globalShortcut", actionName); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     function openInSameTab(note: BNote) { | ||||||
|  |         mainWindow?.webContents.send("openInSameTab", note.noteId); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     const contextMenu = Menu.buildFromTemplate([ |     const contextMenu = Menu.buildFromTemplate([ | ||||||
|         { |         { | ||||||
|             label: "New Note", |             label: "New Note", | ||||||
|             type: "normal", |             type: "normal", | ||||||
|             click: () => triggerKeyboardAction("createNoteIntoInbox") |             click: () => triggerKeyboardAction("createNoteIntoInbox") | ||||||
|         }, |         }, | ||||||
|  |         { | ||||||
|  |             label: "Open today's journal note", | ||||||
|  |             type: "normal", | ||||||
|  |             click: () => openInSameTab(date_notes.getTodayNote()) | ||||||
|  |         }, | ||||||
|         { type: "separator" }, |         { type: "separator" }, | ||||||
|         { |         { | ||||||
|             label: isVisible ? "Hide" : "Show", |             label: isVisible ? "Hide" : "Show", | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Elian Doran
						Elian Doran