From 13289e66a0d084951642898c72f400bf8e793964 Mon Sep 17 00:00:00 2001 From: Kiran Niranjan Date: Wed, 26 Jul 2023 11:54:53 +0530 Subject: [PATCH] SDA-4219 (Change logic to use minimize/restore instead of hide/show) (#1908) * SDA-4219 - Change from hide to minimize Signed-off-by: Kiran Niranjan * SDA-4219 - Remove unused function Signed-off-by: Kiran Niranjan * SDA-4241 - Revert fix for macOS Signed-off-by: Kiran Niranjan --------- Signed-off-by: Kiran Niranjan --- src/app/stores/window-store.ts | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/src/app/stores/window-store.ts b/src/app/stores/window-store.ts index 5a90451a..16122c63 100644 --- a/src/app/stores/window-store.ts +++ b/src/app/stores/window-store.ts @@ -1,7 +1,7 @@ import { BrowserWindow } from 'electron'; import { presenceStatusStore } from '.'; import { apiName } from '../../common/api-interface'; -import { isMac, isWindowsOS } from '../../common/env'; +import { isMac } from '../../common/env'; import { logger } from '../../common/logger'; import { presenceStatus } from '../presence-status-handler'; import { ICustomBrowserWindow, windowHandler } from '../window-handler'; @@ -54,11 +54,15 @@ export class WindowStore { (currentWindow as ICustomBrowserWindow).winName !== apiName.notificationWindowName ) { - if (isFullScreen) { - this.hideFullscreenWindow(currentWindow); - // No need to hide minimized windows - } else if (!isMinimized) { - currentWindow?.hide(); + if (isMac) { + if (isFullScreen) { + this.hideFullscreenWindow(currentWindow); + // No need to hide minimized windows + } else if (!isMinimized) { + currentWindow?.hide(); + } + } else { + currentWindow.minimize(); } } }); @@ -90,14 +94,14 @@ export class WindowStore { currentWindow.id || '', ) as ICustomBrowserWindow; if (window) { - if (currentWindow.isFullScreen) { - fullscreenedWindows.push(currentWindow); - // Window should be shown before putting it in fullscreen on Windows - if (isWindowsOS) { - window.show(); + if (isMac) { + if (currentWindow.isFullScreen) { + fullscreenedWindows.push(currentWindow); + } else if (!currentWindow.minimized && !currentWindow.focused) { + window.showInactive(); } - } else if (!currentWindow.minimized && !currentWindow.focused) { - window.showInactive(); + } else { + window.restore(); } if (currentWindow.focused) { focusedWindowToRestore = window;