Mapping of keyboard shortcuts to OSX

I'm developing on a Mac, and I'm moving most of my actions to code rather than declaring them in plugin.xml. I'm having problems working out when shortcuts using control are mapped to meta for OSX. When I create my actions, I use the "$default" keymap and then register the shortcut using Keymap.addShortcut(). This works fine, and in Settings I can see the value being set in the Default keymap as control-whatever and in the Mac OS X keymap (which derives from "$default") it's reflected as Cmd-whatever, i.e. there's some sort of mapping happening there somewhere. However this doesn't happen when I use shortcut sets registered with AnAction.setShortcutSet(). Currently I'm doing this mapping myself for shortcut sets using SystemInfo.isMac but it's kind of ugly - is there a better way of doing this?


Hi Colin,

It looks like MacOSDefaultKeymap manages keymap modifiers. I think it's a good idea to expand the processing there. Created corresponding feature request, feel free to watch/vote it up - IDEA-103841.



Please sign in to leave a comment.