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