How can I detect that option key is pressed when a menu is selected, to:
That’s not how you generally do things. Rather, you create multiple menu items next to each other in the menu bar, with all but the first having the
isAlternateset. The system then merges them together and only shows the one that matches the current modifiers. And because they are separate menu items, they can have separate actions.
To see this in action:
Create a new project from the Cocoa Application template
In the main menu, select Paste and Match Style and check Alternate in the Attributes inspector
Run the app
When you bring down the edit menu, you’ll just see Paste
If you press command-shift, it’ll change to Paste and Match Style
Share and Enjoy
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"
As it is possible to select which modifier key will triger this.