Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maximized window not restored correctly #13

Open
ajgassner opened this issue Jan 8, 2021 · 0 comments
Open

Maximized window not restored correctly #13

ajgassner opened this issue Jan 8, 2021 · 0 comments

Comments

@ajgassner
Copy link

Steps to reproduce:

  • Open App and maximize window
  • Now minimize (not unmaximize) the window to the task bar
  • Call forceFocus
  • The window pops up but isn't maximized anymore

Workaround:

  1. Add event listeners to the window:
let mainWindowMaximized = false;

mainWindow.on('maximize', () => mainWindowMaximized = true);
mainWindow.on('unmaximize', () => mainWindowMaximized = false);
  1. Restore maximized state after forceFocus:
ipcMain.handle('bring-to-front', () => {
  forceFocus.focusWindow(mainWindow);
  mainWindow.show();

  if (!isMac() && mainWindowMaximized) {
    // workaround
    mainWindow.maximize();
  }
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant