Subscribe to theme change in settings
This commit is contained in:
parent
64fc234490
commit
bdf1287403
8 changed files with 50 additions and 13 deletions
11
main.js
11
main.js
|
@ -61,6 +61,8 @@ let mainWindow;
|
|||
let mainWindowCreated = false;
|
||||
let loadingWindow;
|
||||
|
||||
const activeWindows = new Set();
|
||||
|
||||
function getMainWindow() {
|
||||
return mainWindow;
|
||||
}
|
||||
|
@ -312,6 +314,9 @@ function handleCommonWindowEvents(window) {
|
|||
console.error(`Preload error in ${preloadPath}: `, error.message);
|
||||
});
|
||||
|
||||
activeWindows.add(window);
|
||||
window.on('closed', () => activeWindows.delete(window));
|
||||
|
||||
// Works only for mainWindow because it has `enablePreferredSizeMode`
|
||||
let lastZoomFactor = window.webContents.getZoomFactor();
|
||||
const onZoomChanged = () => {
|
||||
|
@ -1804,8 +1809,10 @@ ipc.on('get-user-data-path', event => {
|
|||
|
||||
// Refresh the settings window whenever preferences change
|
||||
ipc.on('preferences-changed', () => {
|
||||
if (settingsWindow && settingsWindow.webContents) {
|
||||
settingsWindow.webContents.send('render');
|
||||
for (const window of activeWindows) {
|
||||
if (window.webContents) {
|
||||
window.webContents.send('preferences-changed');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue