diff --git a/src/main/core/tray.ts b/src/main/core/tray.ts index 8d19faf..9f79f35 100644 --- a/src/main/core/tray.ts +++ b/src/main/core/tray.ts @@ -140,6 +140,7 @@ const buildContextMenu = async (): Promise => { } export async function createTray(): Promise { + const { useDockIcon = true } = await getAppConfig() if (process.platform === 'linux') { tray = new Tray(pngIcon) } @@ -159,11 +160,16 @@ export async function createTray(): Promise { ipcMain.on('appConfigUpdated', async () => { await updateTrayMenu() }) + tray?.setToolTip('Mihomo Party') tray?.setContextMenu(menu) tray?.setIgnoreDoubleClickEvents(true) if (process.platform === 'darwin') { - app.dock.setMenu(menu) + if (!useDockIcon) { + app.dock.hide() + } else { + app.dock.setMenu(menu) + } tray?.addListener('right-click', () => { if (mainWindow?.isVisible()) { mainWindow?.close() diff --git a/src/renderer/src/pages/settings.tsx b/src/renderer/src/pages/settings.tsx index 343aad0..b1bdea5 100644 --- a/src/renderer/src/pages/settings.tsx +++ b/src/renderer/src/pages/settings.tsx @@ -12,7 +12,7 @@ import { patchControledMihomoConfig } from '@renderer/utils/ipc' import { IoLogoGithub } from 'react-icons/io5' -import { version } from '@renderer/utils/init' +import { platform, version } from '@renderer/utils/init' import useSWR from 'swr' import { Key, useState } from 'react' import debounce from '@renderer/utils/debounce' @@ -29,6 +29,7 @@ const Settings: React.FC = () => { silentStart = false, controlDns = true, controlSniff = true, + useDockIcon = true, delayTestUrl, delayTestTimeout, autoCheckUpdate, @@ -122,6 +123,18 @@ const Settings: React.FC = () => { }} /> + {platform === 'darwin' && ( + + { + patchAppConfig({ useDockIcon: v }) + }} + /> + + )} +