Save selected theme in config

This commit is contained in:
Jonatan Heyman 2023-03-09 09:46:21 +01:00
parent 9d729b6055
commit a106159a9a
2 changed files with 7 additions and 3 deletions

View File

@ -24,7 +24,9 @@ const schema = {
"showLineNumberGutter": {type: "boolean", default:true},
"showFoldGutter": {type: "boolean", default:true},
},
}
},
theme: {type: "string", default: "system"},
}
const defaults = {
@ -33,7 +35,8 @@ const defaults = {
emacsMetaKey: "meta",
showLineNumberGutter: true,
showFoldGutter: true,
}
},
theme: "system",
}
export default new Store({schema, defaults})

View File

@ -109,7 +109,7 @@ async function createWindow() {
}
})
//nativeTheme.themeSource = "light"
nativeTheme.themeSource = CONFIG.get("theme")
if (process.env.VITE_DEV_SERVER_URL) { // electron-vite-vue#298
win.loadURL(url + '?dev=1')
@ -166,6 +166,7 @@ app.on('activate', () => {
})
ipcMain.handle('dark-mode:set', (event, mode) => {
CONFIG.set("theme", mode)
nativeTheme.themeSource = mode
})