mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/mihomo-party-org/clash-party.git
synced 2026-09-20 08:03:39 +08:00
fix: tray icon show on macos
This commit is contained in:
@@ -14,6 +14,7 @@ import pngIcon from '../../../resources/icon.png?asset'
|
||||
import pngIconBlue from '../../../resources/icon_blue.png?asset'
|
||||
import pngIconRed from '../../../resources/icon_red.png?asset'
|
||||
import pngIconGreen from '../../../resources/icon_green.png?asset'
|
||||
import templateIcon from '../../../resources/iconTemplate.png?asset'
|
||||
import { mihomoChangeProxy, mihomoCloseAllConnections, mihomoGroups, patchMihomoConfig, getTrayIconStatus } from '../core/mihomoApi'
|
||||
import { mainWindow, showMainWindow, triggerMainWindow } from '..'
|
||||
import { app, clipboard, ipcMain, Menu, nativeImage, shell, Tray } from 'electron'
|
||||
@@ -334,8 +335,7 @@ export async function createTray(): Promise<void> {
|
||||
tray.setContextMenu(menu)
|
||||
}
|
||||
if (process.platform === 'darwin') {
|
||||
const iconPaths = getIconPaths()
|
||||
const icon = nativeImage.createFromPath(iconPaths.white).resize({ height: 16 })
|
||||
const icon = nativeImage.createFromPath(templateIcon).resize({ height: 16 })
|
||||
icon.setTemplateImage(true)
|
||||
tray = new Tray(icon)
|
||||
}
|
||||
@@ -468,7 +468,6 @@ export async function updateTrayIcon(): Promise<void> {
|
||||
try {
|
||||
if (process.platform === 'darwin') {
|
||||
const icon = nativeImage.createFromPath(iconPath).resize({ height: 16 })
|
||||
icon.setTemplateImage(true)
|
||||
tray.setImage(icon)
|
||||
} else if (process.platform === 'win32') {
|
||||
tray.setImage(iconPath)
|
||||
|
||||
Reference in New Issue
Block a user