新增托盘图标颜色 跟随系统亮暗模式 设置,可以在 设置-其他 启用 (#2016)

This commit is contained in:
lyswhut
2024-08-30 20:21:18 +08:00
parent af8d9dff2d
commit 061cc16c27
7 changed files with 18 additions and 26 deletions
+10 -1
View File
@@ -9,6 +9,7 @@ import {
showWindow as showMainWindow,
} from './winMain'
import { quitApp } from '@main/app'
import { TRAY_AUTO_ID } from '@common/constants'
let tray: Electron.Tray | null
let isEnableTray: boolean = false
@@ -132,7 +133,10 @@ const i18n = {
}
const getIconPath = (id: number) => {
let theme = themeList.find(item => item.id === id) ?? themeList[0]
let theme = id == TRAY_AUTO_ID
? global.lx.theme.shouldUseDarkColors
? themeList[0] : themeList[2]
: themeList.find(item => item.id === id) ?? themeList[0]
return path.join(global.staticPath, 'images/tray', theme.fileName + (isWin ? '.ico' : '.png'))
}
@@ -372,6 +376,11 @@ export default () => {
init()
})
global.lx.event_app.on('system_theme_change', () => {
if (global.lx.appSetting['tray.themeId'] != TRAY_AUTO_ID) return
setTrayImage(global.lx.appSetting['tray.themeId'])
})
global.lx.event_app.on('player_status', (status) => {
let updated = false
if (status.status) {