mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 10:02:59 +08:00
feat(tray): reload bookmarks on change
This commit is contained in:
parent
09bf48e5a4
commit
ebc523a0fd
@ -8,6 +8,15 @@ function reloadFrontendApp(reason?: string) {
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
function reloadTray() {
|
||||
if (!isElectron()) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { ipcRenderer } = dynamicRequire("electron");
|
||||
ipcRenderer.send("reload-tray");
|
||||
}
|
||||
|
||||
function parseDate(str: string) {
|
||||
try {
|
||||
return new Date(Date.parse(str));
|
||||
@ -602,6 +611,7 @@ function isLaunchBarConfig(noteId: string) {
|
||||
|
||||
export default {
|
||||
reloadFrontendApp,
|
||||
reloadTray,
|
||||
parseDate,
|
||||
formatDateISO,
|
||||
formatDateTime,
|
||||
|
@ -2,6 +2,7 @@ import FlexContainer from "./containers/flex_container.js";
|
||||
import OpenNoteButtonWidget from "./buttons/open_note_button_widget.js";
|
||||
import BookmarkFolderWidget from "./buttons/bookmark_folder.js";
|
||||
import froca from "../services/froca.js";
|
||||
import utils from "../services/utils.js";
|
||||
|
||||
export default class BookmarkButtons extends FlexContainer {
|
||||
constructor(isHorizontalLayout) {
|
||||
@ -35,6 +36,8 @@ export default class BookmarkButtons extends FlexContainer {
|
||||
|
||||
buttonWidget.refreshIcon();
|
||||
}
|
||||
|
||||
utils.reloadTray();
|
||||
}
|
||||
|
||||
initialRenderCompleteEvent() {
|
||||
|
@ -9,7 +9,7 @@ import type BNote from "../becca/entities/bnote.js";
|
||||
import becca from "../becca/becca.js";
|
||||
import becca_service from "../becca/becca_service.js";
|
||||
import type BRecentNote from "../becca/entities/brecent_note.js";
|
||||
import { nativeTheme } from "electron/main";
|
||||
import { ipcMain, nativeTheme } from "electron/main";
|
||||
|
||||
let tray: Tray;
|
||||
// `mainWindow.isVisible` doesn't work with `mainWindow.show` and `mainWindow.hide` - it returns `false` when the window
|
||||
@ -60,6 +60,7 @@ function registerVisibilityListener() {
|
||||
mainWindow.on("minimize", updateTrayMenu);
|
||||
mainWindow.on("maximize", updateTrayMenu);
|
||||
nativeTheme.on("updated", updateTrayMenu);
|
||||
ipcMain.on("reload-tray", updateTrayMenu);
|
||||
}
|
||||
|
||||
function updateTrayMenu() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user