From 59d02c7dd6533fe5aea9bc7cfc4e9c74cf2faad6 Mon Sep 17 00:00:00 2001 From: Kiran Niranjan Date: Thu, 10 Aug 2023 13:24:32 +0530 Subject: [PATCH] SDA-4251 - Workaround to fix always on top issue (#1932) Signed-off-by: Kiran Niranjan --- src/app/window-handler.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/app/window-handler.ts b/src/app/window-handler.ts index 985b757a..1c5b5aef 100644 --- a/src/app/window-handler.ts +++ b/src/app/window-handler.ts @@ -597,6 +597,20 @@ export class WindowHandler { MAIN_WEB_CONTENTS_EVENTS, this.mainWebContents, ); + + // workaround for https://perzoinc.atlassian.net/browse/SDA-4251 + this.mainWindow?.on('focus', () => { + const { alwaysOnTop } = config.getConfigFields(['alwaysOnTop']); + logger.info('window-handler: main window focused', alwaysOnTop); + if ( + alwaysOnTop === CloudConfigDataTypes.ENABLED && + this.mainWindow && + windowExists(this.mainWindow) + ) { + this.mainWindow.setAlwaysOnTop(false); + this.mainWindow.setAlwaysOnTop(true); + } + }); } });