From e19d3fb59399504277bb03513e8315b0f2552f0e Mon Sep 17 00:00:00 2001 From: Johannes Millan Date: Thu, 4 Dec 2025 11:09:48 +0100 Subject: [PATCH] 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. --- electron/ipc-handlers/app-control.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/electron/ipc-handlers/app-control.ts b/electron/ipc-handlers/app-control.ts index 2c4dc0d23..a50bee179 100644 --- a/electron/ipc-handlers/app-control.ts +++ b/electron/ipc-handlers/app-control.ts @@ -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 => { 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();