From 247d5bba0a4818891cee0026a8a47356f5beceb4 Mon Sep 17 00:00:00 2001 From: DIYgod Date: Sat, 8 Mar 2025 11:00:19 +0800 Subject: [PATCH] feat: add windows tray menu --- apps/desktop/src/main/src/lib/tray.ts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/apps/desktop/src/main/src/lib/tray.ts b/apps/desktop/src/main/src/lib/tray.ts index d459cf6a7..b0c16516f 100644 --- a/apps/desktop/src/main/src/lib/tray.ts +++ b/apps/desktop/src/main/src/lib/tray.ts @@ -3,6 +3,8 @@ import { app, Menu, nativeImage, Tray } from "electron" import { isMacOS } from "~/env" import { getTrayIconPath } from "~/helper" +import { revealLogFile } from "~/logger" +import { checkForAppUpdates } from "~/updater" import { getMainWindowOrCreate } from "../window" import { t } from "./i18n" @@ -29,6 +31,28 @@ export const registerAppTray = () => { label: t("menu.open", { name }), click: showWindow, }, + { + role: "help", + label: t("menu.help"), + submenu: [ + { role: "reload", label: t("menu.reload") }, + { role: "forceReload", label: t("menu.forceReload") }, + { role: "toggleDevTools", label: t("menu.toggleDevTools") }, + { + label: t("menu.openLogFile"), + click: async () => { + await revealLogFile() + }, + }, + { + label: t("menu.checkForUpdates"), + click: async () => { + showWindow() + await checkForAppUpdates() + }, + }, + ], + }, { label: t("menu.quit", { name }), click: () => app.quit() }, ]) tray.setContextMenu(contextMenu)