1

I've implemented something like Cocoa Keyboard Shortcuts in Dialog without an Edit Menu for an LSUIElement application. In fact, to try to make sure I was not missing some obscure standard keybinding that I might forget to include, I just grabbed a standard "edit" menu and loaded it out of a nib file and then used my NSApplication subclass's sendEvent: to invoke its performKeyEquivalent: . This works as I expect.

However, the character palette (or "emoji picker", or "Emoji & Symbols") is not explicitly in this menu, so when I hit the hotkey (⌘⌃Space) nothing happens. Examining the objects, this is what I expect. However, when I hit this hotkey in a normal application, I see the Edit menu flash as if that's where the key's defined, even if it isn't. Stranger still, still works even though the control-command-space one doesn't.

Where is this keyboard shortcut supposed to be handled? I don't want to do anything particularly custom here, I'd just like to correctly set up the default text-editing behavior that other apps get.

Glyph
  • 31,152
  • 11
  • 87
  • 129
  • I *can* manually make this happen by wiring up a custom menu item in my hidden edit menu and setting its action to the Application nib object's `orderFrontCharacterPalette:` action, but this feels janky as heck. Is this how that's supposed to work? – Glyph May 14 '22 at 06:35
  • Is the Emoji & Symbols item in the menu of the normal application at runtime? – Willeke May 14 '22 at 07:43
  • I made a new app and *yes it is*! Wow that is weird. What is doing that? – Glyph May 15 '22 at 13:03
  • `NSApplication` customizes the menus, have you tried "You just need to leave the original main menu in MainMenu.xib"? – Willeke May 17 '22 at 05:32
  • @Willeke I haven't tried that but I guess I'll give it a shot at some point. I specifically *avoided* calling my bonus stock-menu UI `MainMenu.xib` so as not to conflict with any unwanted functionality. For the purposes of this question I will still give it a shot but I'm starting to wonder if I should just start up as a normal application so that these normal-looking windows have a normal-looking menu bar and `TransformProcessType` myself into the background when only the status item should be visible. Thanks for the suggestion! – Glyph May 18 '22 at 17:35

0 Answers0