inbox-app icon indicating copy to clipboard operation
inbox-app copied to clipboard

Hide the app window instead of closing it

Open marcingrabda opened this issue 9 years ago • 8 comments

Hey,

I have made a simple change to hide the application window instead of closing it. I believe it makes it more consistent with how other Mac apps work.

Regards, Marcin

marcingrabda avatar Aug 11 '16 22:08 marcingrabda

Thanks! I agree this makes more sense. What about moving the whole fs.writeFileSync(...) part to the before-quit handler in order to get rid of the quit var?

fgnass avatar Aug 11 '16 22:08 fgnass

Even if I move it there, don't we still need the variable?

marcingrabda avatar Aug 11 '16 22:08 marcingrabda

I think you're right. I thought we could always prevent the default and hide the window but then the app will no longer exit.

fgnass avatar Aug 11 '16 23:08 fgnass

Hm, what about multiple windows when using the app with multiple accounts?

fgnass avatar Aug 11 '16 23:08 fgnass

How can I test that? I mean, is this in any way supported?

marcingrabda avatar Aug 12 '16 00:08 marcingrabda

Ok, I will look into that and try to fix it. I didn't consider it when making the changes and it definitely breaks this functionality.

marcingrabda avatar Aug 12 '16 21:08 marcingrabda

I have been using the application with my changes for 3 weeks already and it seems to work fine with one window. I am not really sure how it should behave with more than one window. After closing last window clicking on dock reopens the window. What should really be changed in case of any additional window?

marcingrabda avatar Sep 04 '16 05:09 marcingrabda

The typically way to do this is below:

app.on('window-all-closed', () => {
  // Don't quit on closing windows on MacOS
  if (process.platform !== 'darwin') {
    app.quit();
  }
});

// Create window if it doesn't exist (such as closing on MacOS)
app.on('activate', () => {
  if (!mainWindow) {
    mainWindow = createMainWindow();
  }
});

mikhailbot avatar Nov 16 '16 03:11 mikhailbot