From f046b61a6d11da27abeb23f8c72d2d4e315ef33f Mon Sep 17 00:00:00 2001 From: Adam777 Date: Mon, 7 Nov 2022 23:55:11 +0100 Subject: [PATCH] Maximize window visual glitch on Windows fix (fix #1447) (PR #1448) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix for [Maximize window visual glitch on Windows · Issue #1447 · nativefier/nativefier](https://github.com/nativefier/nativefier/issues/1447) Co-authored-by: Ronan Jouchet --- app/src/components/mainWindow.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/components/mainWindow.ts b/app/src/components/mainWindow.ts index 0dda35b..41731c1 100644 --- a/app/src/components/mainWindow.ts +++ b/app/src/components/mainWindow.ts @@ -73,7 +73,10 @@ export async function createMainWindow( // Whether the window should always stay on top of other windows. Default is false. alwaysOnTop: options.alwaysOnTop, titleBarStyle: options.titleBarStyle ?? 'default', - show: options.tray !== 'start-in-tray', + // Maximize window visual glitch on Windows fix + // We want a consistent behavior on all OSes, but Windows needs help to not glitch. + // So, we manually mainWindow.show() later, see a few lines below + show: options.tray !== 'start-in-tray' && process.platform !== 'win32', backgroundColor: options.backgroundColor, ...getDefaultWindowOptions(outputOptionsToWindowOptions(options)), }); @@ -94,6 +97,9 @@ export async function createMainWindow( if (options.tray === 'start-in-tray') { mainWindow.hide(); + } else if (process.platform === 'win32') { + // See other "Maximize window visual glitch on Windows fix" comment above. + mainWindow.show(); } const windowOptions = outputOptionsToWindowOptions(options);