优化托盘图标显示(#1842)
|
@ -1,3 +1,7 @@
|
||||||
|
### 优化
|
||||||
|
|
||||||
|
- 优化白色托盘图标显示,修复windows下托盘图标不清晰的问题
|
||||||
|
|
||||||
### 修复
|
### 修复
|
||||||
|
|
||||||
- 修复存在多级弹窗时的背景显示问题
|
- 修复存在多级弹窗时的背景显示问题
|
||||||
|
|
|
@ -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 = () => {
|
export const createTray = () => {
|
||||||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
||||||
if ((tray && !tray.isDestroyed()) || !global.lx.appSetting['tray.enable']) return
|
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')
|
tray.setToolTip('LX Music')
|
||||||
createMenu()
|
createMenu()
|
||||||
|
@ -259,9 +260,7 @@ export const createMenu = () => {
|
||||||
|
|
||||||
export const setTrayImage = (themeId: number) => {
|
export const setTrayImage = (themeId: number) => {
|
||||||
if (!tray) return
|
if (!tray) return
|
||||||
let theme = themeList.find(item => item.id === themeId) ?? themeList[0]
|
tray.setImage(nativeImage.createFromPath(getIconPath(themeId)))
|
||||||
const iconPath = path.join(global.staticPath, 'images/tray', theme.fileName + '.png')
|
|
||||||
tray.setImage(nativeImage.createFromPath(iconPath))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const init = () => {
|
const init = () => {
|
||||||
|
|
After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 335 B After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 416 B After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 483 B After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 622 B After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 4.2 KiB |