diff --git a/publish/changeLog.md b/publish/changeLog.md index d8837a5a..3ac4f6a7 100644 --- a/publish/changeLog.md +++ b/publish/changeLog.md @@ -1,3 +1,7 @@ +### 优化 + +- 优化白色托盘图标显示,修复windows下托盘图标不清晰的问题 + ### 修复 - 修复存在多级弹窗时的背景显示问题 diff --git a/src/main/modules/tray.ts b/src/main/modules/tray.ts index 7d6b6906..310b5f69 100644 --- a/src/main/modules/tray.ts +++ b/src/main/modules/tray.ts @@ -117,16 +117,17 @@ const i18n = { }, } +const getIconPath = (id: number) => { + let theme = themeList.find(item => item.id === id) ?? themeList[0] + return path.join(global.staticPath, 'images/tray', theme.fileName + (isWin ? '.ico' : '.png')) +} + export const createTray = () => { // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing if ((tray && !tray.isDestroyed()) || !global.lx.appSetting['tray.enable']) return - themeId = global.lx.appSetting['tray.themeId'] - let theme = themeList.find(item => item.id === themeId) ?? themeList[0] - const iconPath = path.join(global.staticPath, 'images/tray', theme.fileName + '.png') - // 托盘 - tray = new Tray(nativeImage.createFromPath(iconPath)) + tray = new Tray(nativeImage.createFromPath(getIconPath(global.lx.appSetting['tray.themeId']))) tray.setToolTip('LX Music') createMenu() @@ -259,9 +260,7 @@ export const createMenu = () => { export const setTrayImage = (themeId: number) => { if (!tray) return - let theme = themeList.find(item => item.id === themeId) ?? themeList[0] - const iconPath = path.join(global.staticPath, 'images/tray', theme.fileName + '.png') - tray.setImage(nativeImage.createFromPath(iconPath)) + tray.setImage(nativeImage.createFromPath(getIconPath(themeId))) } const init = () => { diff --git a/src/static/images/tray/trayTemplate.ico b/src/static/images/tray/trayTemplate.ico new file mode 100644 index 00000000..47758b44 Binary files /dev/null and b/src/static/images/tray/trayTemplate.ico differ diff --git a/src/static/images/tray/trayTemplate.png b/src/static/images/tray/trayTemplate.png index c67852ff..b6fe6e4c 100644 Binary files a/src/static/images/tray/trayTemplate.png and b/src/static/images/tray/trayTemplate.png differ diff --git a/src/static/images/tray/trayTemplate@1.25x.png b/src/static/images/tray/trayTemplate@1.25x.png index 9039101f..c5a84d47 100644 Binary files a/src/static/images/tray/trayTemplate@1.25x.png and b/src/static/images/tray/trayTemplate@1.25x.png differ diff --git a/src/static/images/tray/trayTemplate@1.5x.png b/src/static/images/tray/trayTemplate@1.5x.png index 2e9c29e4..3494082e 100644 Binary files a/src/static/images/tray/trayTemplate@1.5x.png and b/src/static/images/tray/trayTemplate@1.5x.png differ diff --git a/src/static/images/tray/trayTemplate@2x.ico b/src/static/images/tray/trayTemplate@2x.ico new file mode 100644 index 00000000..87f64e05 Binary files /dev/null and b/src/static/images/tray/trayTemplate@2x.ico differ diff --git a/src/static/images/tray/trayTemplate@2x.png b/src/static/images/tray/trayTemplate@2x.png index 67d55fa3..eba7d7f4 100644 Binary files a/src/static/images/tray/trayTemplate@2x.png and b/src/static/images/tray/trayTemplate@2x.png differ diff --git a/src/static/images/tray/tray_black.ico b/src/static/images/tray/tray_black.ico new file mode 100644 index 00000000..67770123 Binary files /dev/null and b/src/static/images/tray/tray_black.ico differ diff --git a/src/static/images/tray/tray_black@2x.ico b/src/static/images/tray/tray_black@2x.ico new file mode 100644 index 00000000..7c4965fd Binary files /dev/null and b/src/static/images/tray/tray_black@2x.ico differ