1

I'm working with MacOS X 10.6.

I'd like to define a keyboard shortcut Ctrl-m, which does the same thing like RETURN does, without deactivating RETURN.

How can I do that in MacOS X 10.6. In the keyboard control panel, I can only assign menu commands to shortcuts, but RETURN is not a menu command, but a key that does different things in different locations.

How can I do that?


Remark:

  • 1
    I use Keyboard Maestro for that kind of things. – jherran Nov 14 '14 at 23:13
  • Thanks! Well, I'd like to avoid paying 42$ just for changing a few keybindings, which (I'd assume) should also be possible with some "hacking", shouldn't it? Anyway, are you sure Keyboard Maestro would be able to create such a shortkey which has the same effect like RETURN in Safari? – MostlyHarmless Nov 14 '14 at 23:30
  • 1
    Pretty sure. I posted an answer with an image of a macro that do it. – jherran Nov 14 '14 at 23:35
1

You could do it using Keyboard Maestro.

enter image description here

1

It might be possible using Quicksilver to run an AppleScript that “types” Return, but that will probably be unreliable in some contexts.

A much more straightforward solution that doesn’t require any third-party tools is to just use the built-in key bindings system.

Add this to ~/Library/KeyBindings/DefaultKeyBinding.dict:

{
    "^m" = "insertNewline:";
}

Things to be aware of:

  1. That file doesn’t exist by default. You’ll need to create it.
  2. This won’t apply to any applications that are already running. Relaunch the ones you want to use it in, or just log out and back in.
  3. This only works in proper Cocoa applications. Cross-platform stuff like Firefox and MS Office won’t respect these key bindings.
  4. More detail on the built-in key binding system can be found at http://www.hcs.harvard.edu/~jrus/Site/System%20Bindings.html
  • Hi Rob! Thanks a lot! AppleScripts are relatively slow from my experience, so I'd prefer the key-binding solution. Thanks a lot for the very useful hint on "proper Cocoa apps"!! Question: how can I find out, if an application is "proper Cocoa"? – MostlyHarmless Nov 16 '14 at 7:41
  • p.s. is there a way to find out, if that key-binding (e. g. ^m is already used/defined in other applications? – MostlyHarmless Nov 16 '14 at 7:47
  • I don’t know of a sure-fire way to tell if something is Cocoa other than checking with the developer. Inconsistent appearance is the biggest clue. As for figuring out where it’s used, you’ll just have to look around at the menus or try pressing it in different apps to see what happens. I would hope that a standard on like ⌃M isn’t used anywhere (unless it’s already used as Return). – Rob McBroom Nov 17 '14 at 14:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .