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
Add Services submenu on macOS #73
Conversation
Can you open an Electron issue about what you mentioned above? |
Absolutely – I'd been intending to do so, but hadn't got around to it yet. |
Electron bug: electron/electron#18476 |
What apps? I tried Chrome, Safar, TextEdit, Notes, and none of them have a "Services" menu item when right-clicking text. Instead, they all have a "Share" menu (electron/electron#6330). |
Interesting! All of the above have both a "Share" menu and a "Services" menu for me (the screenshot in #72 is from Safari). I'm on macOS 10.14.5. I wonder what the difference is in our configs? That said, I haven't been able to find the Cocoa method for use in a context menu for the Services menu, whereas the one for the Share menu is easy to find ( Maybe a "Share" menu is a more useful addition anyway! Obviously dependent on electron/electron#6330. |
Further oddity: Preview has "Services" and not "Share" for me. What does it have for you? |
Turns out I didn't have any applicable Services enabled. I see it in Safari and Chrome now. Can you fix the merge conflict? |
index.d.ts
Outdated
@@ -60,6 +60,7 @@ declare namespace contextMenu { | |||
|
|||
interface Actions { | |||
readonly separator: () => MenuItem; | |||
readonly services: () => MenuItem; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be ordered after inspect
, like in the menu.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done – I hadn't realised that was the intended ordering here.
Bearing that in mind, I seem to have put the entries for lookUpSelection
in the wrong place too; shall I submit a PR to fix that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shall I submit a PR to fix that?
👍 And also the labels thing in the same PR.
Aha, cool!
Happy to do so. Are you going to commit this anyway then, or not unless the Electron implementation is fixed? If we implement it in its current state, maybe (I'm not sure) it should default to off, since it's not identical to the native implementation? What do you think? |
Yes
Sure, let's keep it off for now. |
Rebased onto current master to fix the merge conflicts, and I think I've addressed all the other issues discussed. |
Turns out that although Electron (not macOS) sets the default label, we can override it ourselves. |
Adds support for the system “Services” menu on macOS.
Enabled by default; can be disabled using
showServices: false
.Only enabled for text; this seems to be standard across most Mac apps.
Note that the menu is not identical to that shown by native apps in the context menu – in fact it is the same as the “Services” submenu in the application menu in the main menubar.
This is because of Electron's implementation of the
{ role: services }
menu API, and should probably be filed as a bug with Electron core (Chromium has support).Screenshot:
Closes #72