Skip to content
This repository has been archived by the owner on Aug 30, 2023. It is now read-only.

OSX version cannot open new file after closing window #32

Closed
terry182 opened this issue Mar 1, 2016 · 13 comments
Closed

OSX version cannot open new file after closing window #32

terry182 opened this issue Mar 1, 2016 · 13 comments

Comments

@terry182
Copy link

terry182 commented Mar 1, 2016

This error message pop up when trying to open new files after closing the old windows.

Uncaught Exception:
TypeError: Cannot read property 'webContents' of undefined
at sendCommand (/opt/homebrew-cask/Caskroom/abricotine/0.2.2/Abricotine.app/Contents/Resources/app.asar/app/abr-menu.js:29:16)
at /opt/homebrew-cask/Caskroom/abricotine/0.2.2/Abricotine.app/Contents/Resources/app.asar/app/abr-menu.js:37:42
at MenuItem.click (/opt/homebrew-cask/Caskroom/abricotine/0.2.2/Abricotine.app/Contents/Resources/atom.asar/browser/api/lib/menu-item.js:56:20)
at Function.delegate.executeCommand (/opt/homebrew-cask/Caskroom/abricotine/0.2.2/Abricotine.app/Contents/Resources/atom.asar/browser/api/lib/menu.js:125:71)

@brrd
Copy link
Owner

brrd commented Mar 1, 2016

I need more informations about this behaviour.
Did you close all the windows before opening a new document or just some of them?
Is the app still running after you close all the windows?
If it is, can you see its menu bar?

@terry182
Copy link
Author

terry182 commented Mar 1, 2016

I closed all the windows. The app is still runing when the error occurs and the menu bars still there.

The error also occurs when opening existing files.

@brrd
Copy link
Owner

brrd commented Mar 1, 2016

OK, so this is related to OS X behaviour.
Abricotine is supposed to exit when you close its last window, but on OS X applications remain open until you exit, even if all windows are closed. I guess that we need to rethink the way Abricotine manages its menu.
Thanks for reporting.

@brrd
Copy link
Owner

brrd commented Apr 16, 2016

I guess 088df47 should fix this issue but I need someone to test it on OSX please. You will have to build Abricotine from the osx-menu branch.

Expected behaviour: when all windows are closed, the menubar should be updated in order to provide fewer menu items. Please make sure that all menu items are working well when clicked from here.
When a new window is opened, the menu bar should provide all items again.

@nloveladyallen
Copy link
Contributor

nloveladyallen commented Apr 16, 2016

When the last window is closed, the menus change as you have said should happen. When attempting to open a new window, the same error occurs, with slightly different line numbers (presumably due to incidental changes to the relevant files).

I will also note that menus on OS X do not usually change depending on whether there is a window open. If a menu is no longer relevant, all its options will become greyed out, but it still appears in the menu bar.

@brrd
Copy link
Owner

brrd commented Apr 16, 2016

@nloveladyallen Thank you. So I'll keep working on it.

brrd added a commit that referenced this issue Apr 26, 2016
Remove menu-app.json. We use a single menu for the whole application by 
adding the "permanent" attribute which identify menu items to keep active when all 
windows are closed (OSX). 

Note: commands-main are still used when a command is triggered from the main 
process (ie no windows).

See #32.
@brrd
Copy link
Owner

brrd commented Apr 26, 2016

This should be fixed with a642a9e

If a menu is no longer relevant, all its options will become greyed out, but it still appears in the menu bar.

So we moved to this behaviour in d5d020c

Could someone give me feedback please? You can try it by building the app from osx-menu branch. Thanks.

@nloveladyallen
Copy link
Contributor

The menus no longer change, and regular items are greyed out. Submenus still show up with their options greyed out, while typically apps grey out the submenu entirely (hovering does nothing).

There is now a different error when opening a new window after closing the last one:

Uncaught Exception:
TypeError: abrApp.open is not a function
at Object.commands.new (/Users/noah/src/Abricotine/dist/Abricotine-darwin-x64/Abricotine.app/Contents/Resources/app.asar/app/commands-main.js:15:16)
at AbrApplication.execCommand (/Users/noah/src/Abricotine/dist/Abricotine-darwin-x64/Abricotine.app/Contents/Resources/app.asar/app/abr-application.js:126:30)
at /Users/noah/src/Abricotine/dist/Abricotine-darwin-x64/Abricotine.app/Contents/Resources/app.asar/app/abr-menu.js:33:42
at MenuItem.click (/Users/noah/src/Abricotine/dist/Abricotine-darwin-x64/Abricotine.app/Contents/Resources/atom.asar/browser/api/lib/menu-item.js:56:20)
at Function.delegate.executeCommand (/Users/noah/src/Abricotine/dist/Abricotine-darwin-x64/Abricotine.app/Contents/Resources/atom.asar/browser/api/lib/menu.js:125:71)

@brrd
Copy link
Owner

brrd commented Apr 27, 2016

OK, thank you.

@brrd
Copy link
Owner

brrd commented Apr 27, 2016

Could you try it again please?

typically apps grey out the submenu entirely (hovering does nothing)

I don't know how to do this with electron (I'm not even sure it's possible) so in this last revision menus are simply removed when all their items are disabled.

Thanks.

@nloveladyallen
Copy link
Contributor

Closing the last window and creating a new document or opening a document now works correctly.

I feel it is more disorienting to have the menus disappear than have the submenus still show as active, and that the way it worked as of d5d020c is best. It may not be possible to disable a submenu with Electron; Atom leaves submenus active as well.

@brrd
Copy link
Owner

brrd commented Apr 28, 2016

@nloveladyallen thanks

I feel it is more disorienting to have the menus disappear than have the submenus still show as active, and that the way it worked as of d5d020c is best.

OK, I will revert e6e97dd

brrd added a commit that referenced this issue Apr 28, 2016
This reverts commit e6e97dd.

See discussion: #32
@brrd
Copy link
Owner

brrd commented Apr 28, 2016

Done and merged osx-menu into develop.

@brrd brrd closed this as completed Apr 28, 2016
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

No branches or pull requests

3 participants