fix(electron): minimize to tray not working immediately after enabling

Closes #5622

The 'Minimize to tray' setting was not updating the main process shared state when changed in the settings, requiring an app restart to take effect. This was because the 'UPDATE_SETTINGS' IPC event (sent on change) was not updating the 'isMinimizeToTray' flag. This commit ensures that 'UPDATE_SETTINGS' updates the relevant shared state.
This commit is contained in:
Johannes Millan 2025-12-04 11:09:48 +01:00
parent c2ba004e2f
commit e19d3fb593

View file

@ -21,7 +21,7 @@ export const initAppControlIpc = (): void => {
ipcMain.on(IPC.OPEN_DEV_TOOLS, () => getWin().webContents.openDevTools());
ipcMain.on(IPC.RELOAD_MAIN_WIN, () => getWin().reload());
ipcMain.on(IPC.TRANSFER_SETTINGS_TO_ELECTRON, async (ev, cfg: GlobalConfigState) => {
const updateSettings = async (ev: any, cfg: GlobalConfigState): Promise<void> => {
setIsMinimizeToTray(cfg.misc.isMinimizeToTray);
setIsTrayShowCurrentTask(cfg.misc.isTrayShowCurrentTask);
setIsTrayShowCurrentCountdown(cfg.misc.isTrayShowCurrentCountdown);
@ -32,7 +32,10 @@ export const initAppControlIpc = (): void => {
cfg.misc.isUseCustomWindowTitleBar,
);
}
});
};
ipcMain.on(IPC.TRANSFER_SETTINGS_TO_ELECTRON, updateSettings);
ipcMain.on(IPC.UPDATE_SETTINGS, updateSettings);
ipcMain.on(IPC.SHOW_OR_FOCUS, () => {
const mainWin = getWin();