修复亮暗主题自动切换功能无效的问题(#1697)

This commit is contained in:
lyswhut
2023-11-22 12:20:15 +08:00
parent 1712e466d5
commit 3e7db5617b
4 changed files with 13 additions and 6 deletions
+6 -4
View File
@@ -172,9 +172,11 @@ export const listenerAppEvent = (startApp: () => void) => {
initScreenParams()
})
nativeTheme.addListener('updated', (event: any) => {
const themeInfo: Electron.NativeTheme = event.sender
global.lx?.event_app.system_theme_change(themeInfo.shouldUseDarkColors)
nativeTheme.addListener('updated', () => {
const shouldUseDarkColors = nativeTheme.shouldUseDarkColors
if (shouldUseDarkColors == global.lx.theme.shouldUseDarkColors) return
global.lx.theme.shouldUseDarkColors = shouldUseDarkColors
global.lx?.event_app.system_theme_change(shouldUseDarkColors)
})
}
@@ -224,7 +226,7 @@ export const initAppSetting = async() => {
state: new Map(),
},
theme: {
shouldUseDarkColors: false,
shouldUseDarkColors: nativeTheme.shouldUseDarkColors,
theme: {
id: '',
name: '',