添加黑色托盘图标

This commit is contained in:
lyswhut
2021-10-27 17:11:35 +08:00
parent ea62033cf3
commit cdbcae21ac
18 changed files with 19 additions and 6 deletions
+11 -6
View File
@@ -7,12 +7,17 @@ let themeId = null
const themeList = [
{
id: 0,
fileName: 'tray0Template',
fileName: 'trayTemplate',
isNative: true,
},
{
id: 1,
fileName: 'tray1Template',
fileName: 'tray_origin',
isNative: false,
},
{
id: 2,
fileName: 'tray_black',
isNative: false,
},
]
@@ -43,8 +48,8 @@ const createTray = () => {
if ((global.modules.tray && !global.modules.tray.isDestroyed()) || !global.appSetting.tray || !global.appSetting.tray.isShow) return
themeId = global.appSetting.tray.themeId
let themeName = (themeList.find(item => item.id === themeId) || themeList[0]).fileName
const iconPath = path.join(global.__static, 'images/tray', themeName + '.png')
let theme = themeList.find(item => item.id === themeId) || themeList[0]
const iconPath = path.join(global.__static, 'images/tray', theme.fileName + '.png')
// 托盘
global.modules.tray = new Tray(nativeImage.createFromPath(iconPath))
@@ -140,7 +145,7 @@ const createMenu = tray => {
const setTrayImage = themeId => {
if (!global.modules.tray) return
let themeName = (themeList.find(item => item.id === themeId) || themeList[0]).fileName
const iconPath = path.join(global.__static, 'images/tray', themeName + '.png')
let theme = themeList.find(item => item.id === themeId) || themeList[0]
const iconPath = path.join(global.__static, 'images/tray', theme.fileName + '.png')
global.modules.tray.setImage(nativeImage.createFromPath(iconPath))
}