Load/Unload theme without restarting (#2458)

This commit is contained in:
CHaBou 2017-11-29 14:22:29 +01:00 committed by GitHub
parent a59ccc3ff4
commit d148c486f5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View file

@ -36,6 +36,11 @@ module.exports = class Window {
const rpc = createRPC(window);
const sessions = new Map();
const updateBackgroundColor = () => {
const cfg_ = app.plugins.getDecoratedConfig();
window.setBackgroundColor(toElectronBackgroundColor(cfg_.backgroundColor || '#000'));
};
// config changes
const cfgUnsubscribe = app.config.subscribe(() => {
const cfg_ = app.plugins.getDecoratedConfig();
@ -49,11 +54,12 @@ module.exports = class Window {
}
// update background color if necessary
updateBackgroundColor();
cfg = cfg_;
});
rpc.on('init', () => {
window.setBackgroundColor(toElectronBackgroundColor(cfg.backgroundColor || '#000'));
window.show();
// If no callback is passed to createWindow,
@ -234,6 +240,7 @@ module.exports = class Window {
if (!err) {
load();
window.webContents.send('plugins change');
updateBackgroundColor();
}
});

View file

@ -155,7 +155,7 @@ const reducer = (state = initial, action) => {
ret.backgroundColor = config.backgroundColor;
}
if (config.css) {
if (config.css || config.css === '') {
ret.css = config.css;
}