Get native theme through IPC not remote
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
|
||||
/* global window */
|
||||
|
||||
const { ipcRenderer, remote } = require('electron');
|
||||
const { ipcRenderer } = require('electron');
|
||||
|
||||
const url = require('url');
|
||||
const i18n = require('./js/modules/i18n');
|
||||
@@ -18,11 +18,9 @@ const { locale } = config;
|
||||
const localeMessages = ipcRenderer.sendSync('locale-data');
|
||||
setEnvironment(parseEnvironment(config.environment));
|
||||
|
||||
const { nativeTheme } = remote.require('electron');
|
||||
|
||||
const { Context: SignalContext } = require('./ts/context');
|
||||
|
||||
window.SignalContext = new SignalContext();
|
||||
window.SignalContext = new SignalContext(ipcRenderer);
|
||||
|
||||
window.platform = process.platform;
|
||||
window.theme = config.theme;
|
||||
@@ -30,19 +28,6 @@ window.i18n = i18n.setup(locale, localeMessages);
|
||||
window.appStartInitialSpellcheckSetting =
|
||||
config.appStartInitialSpellcheckSetting === 'true';
|
||||
|
||||
function setSystemTheme() {
|
||||
window.systemTheme = nativeTheme.shouldUseDarkColors ? 'dark' : 'light';
|
||||
}
|
||||
|
||||
setSystemTheme();
|
||||
|
||||
window.subscribeToSystemThemeChange = fn => {
|
||||
nativeTheme.on('updated', () => {
|
||||
setSystemTheme();
|
||||
fn();
|
||||
});
|
||||
};
|
||||
|
||||
window.getEnvironment = getEnvironment;
|
||||
window.getVersion = () => config.version;
|
||||
window.getAppInstance = () => config.appInstance;
|
||||
|
Reference in New Issue
Block a user