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

[Mac-only] Remove "Start Dictation" and "Special characters" from window menu #2812

Closed
felicienfrancois opened this issue Dec 16, 2014 · 4 comments

Comments

@felicienfrancois
Copy link

We should be able to remove thoose menu items.
Its seems to be added in all cases to the second window menu item, whatever its name.

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@tommoor
Copy link

tommoor commented Dec 17, 2014

The "Edit" menu? These are OSX standard, removing dictation in particular would be an accessibility barrier - I'd be interested to know the reasoning?

@felicienfrancois
Copy link
Author

First thoose menu items are not necessarily in the Edit menu (the edit menu can be disabled with the hideEdit option).
Its are appended in all cases to the second menu whatever it is (so it may be a non sense to have it in this menu).

Secondly, unlike other native menus its are not translated in the local language.

Thirdly, unlike other native menus, they are not changeable / overridable because they cannot be seen through nw api. So it is impossible to adapt the availability of the feature or the way it work depending on the context.

Then, depending on the app it may be misleading for the user (Especially when there are no text inputs). It could also be an issue for code editors because dictation does not work well for code and it is not recommanded to use Apple special characters :-)

@Montoya
Copy link

Montoya commented May 19, 2016

Any update on this? I'm running into this issue over a year later...

@rogerwang rogerwang added this to the 0.14.x milestone May 19, 2016
ghostoy pushed a commit to ghostoy/nw.js that referenced this issue Jul 20, 2016
On Mac, the system will add several menu items to Edit menu, like
`Emoji & Symbols` or `Start Dictation...`. These items are added
after setting main menu. This patch will update menu items after
setting main menu. Then developers can iterate items under edit
menu and remove corresponding items.

fixed nwjs#2812
@ghostoy
Copy link
Member

ghostoy commented Jul 21, 2016

@Montoya @felicienfrancois I made a PR #5132 which updates the menu items under Edit menu when setting menubar for your app. Then you can iterate the items and decide whether to remove the items or not. A new property of nw.MenuItem called native is a boolean to indicate whether they are added by native system.

For example,

var menu = new nw.Menu({type:'menubar'});
menu.createMacBuiltin('myapp');
nw.Window.get().menu = menu;

// iterate the items under Edit
var editMenu = menu.items[1].submenu;
editMenu.items.forEach((item, i)=>{
  // remove all native items
  if (item.native) editMenu.remove(item);
});

If you want to keep just one, item.label will tell you the name of the item. Keep the one you want and remove the others. In my test, the automatically added items are actually localized, which is different from @felicienfrancois 's investigation. There is no way to tell the translated names for them AFAIK. So be careful when testing the names of the items if you just want to keep one.

ghostoy pushed a commit to ghostoy/nw.js that referenced this issue Jul 21, 2016
On Mac, the system will add several menu items to Edit menu, like
`Emoji & Symbols` or `Start Dictation...`. These items are added
after setting main menu. This patch will update menu items after
setting main menu. Then developers can iterate items under edit
menu and remove corresponding items.

fixed nwjs#2812
ghostoy pushed a commit to ghostoy/nw.js that referenced this issue Jul 26, 2016
On Mac, the system will add several menu items to Edit menu, like
`Emoji & Symbols` or `Start Dictation...`. These items are added
after setting main menu. This patch will update menu items after
setting main menu. Then developers can iterate items under edit
menu and remove corresponding items.

fixed nwjs#2812
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants