mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-13 04:28:41 -09:00
Load/Unload theme without restarting (#2458)
This commit is contained in:
parent
a59ccc3ff4
commit
d148c486f5
2 changed files with 9 additions and 2 deletions
|
|
@ -36,6 +36,11 @@ module.exports = class Window {
|
||||||
const rpc = createRPC(window);
|
const rpc = createRPC(window);
|
||||||
const sessions = new Map();
|
const sessions = new Map();
|
||||||
|
|
||||||
|
const updateBackgroundColor = () => {
|
||||||
|
const cfg_ = app.plugins.getDecoratedConfig();
|
||||||
|
window.setBackgroundColor(toElectronBackgroundColor(cfg_.backgroundColor || '#000'));
|
||||||
|
};
|
||||||
|
|
||||||
// config changes
|
// config changes
|
||||||
const cfgUnsubscribe = app.config.subscribe(() => {
|
const cfgUnsubscribe = app.config.subscribe(() => {
|
||||||
const cfg_ = app.plugins.getDecoratedConfig();
|
const cfg_ = app.plugins.getDecoratedConfig();
|
||||||
|
|
@ -49,11 +54,12 @@ module.exports = class Window {
|
||||||
}
|
}
|
||||||
|
|
||||||
// update background color if necessary
|
// update background color if necessary
|
||||||
|
updateBackgroundColor();
|
||||||
|
|
||||||
cfg = cfg_;
|
cfg = cfg_;
|
||||||
});
|
});
|
||||||
|
|
||||||
rpc.on('init', () => {
|
rpc.on('init', () => {
|
||||||
window.setBackgroundColor(toElectronBackgroundColor(cfg.backgroundColor || '#000'));
|
|
||||||
window.show();
|
window.show();
|
||||||
|
|
||||||
// If no callback is passed to createWindow,
|
// If no callback is passed to createWindow,
|
||||||
|
|
@ -234,6 +240,7 @@ module.exports = class Window {
|
||||||
if (!err) {
|
if (!err) {
|
||||||
load();
|
load();
|
||||||
window.webContents.send('plugins change');
|
window.webContents.send('plugins change');
|
||||||
|
updateBackgroundColor();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -155,7 +155,7 @@ const reducer = (state = initial, action) => {
|
||||||
ret.backgroundColor = config.backgroundColor;
|
ret.backgroundColor = config.backgroundColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.css) {
|
if (config.css || config.css === '') {
|
||||||
ret.css = config.css;
|
ret.css = config.css;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue