6

I'm looking for a method that will allow me to turn custom, nonstandard key combinations into a currently-unused intermediary key (like F16 or something). The intermediary key would then be able to be recognized in other applications (such as FastScripts), so that I can finally assign this intermediary keyboard shortcut to whatever action within that application that I desire.

By "nonstandard key combinations," I mean combinations that do not incorporate any modifier key (that is, ⌘ command, ⌥ option, ⌃ control, fn, or ⇧ shift).

Examples of nonstandard key combinations, pressed simultaneously:

  • 1 + 0

  • A + D

  • space bar + V

  • W + 5

  • tab + Q

I have installed Karabiner, but I don't see a way to accomplish this in Karabiner.

Are there any programs that can do what I am looking for?

OS X El Capitan, version 10.11.6.

  • maybe BTT's key sequences could work. docs.bettertouchtool.net/docs/key_sequences.html. – hyph Mar 9 '17 at 22:12
  • @hyph Interesting. I am unfamiliar with BetterTouchTool. Do you know if it will only work if the key presses occur in a sequence, or will it also work if the key presses occur simultaneously? – rubik's sphere Mar 9 '17 at 22:17
  • I think I actually didn't read your requirements correctly. You can only trigger these sequences with a regular shortcut (with a modifier). Not the other way around. – hyph Mar 9 '17 at 22:52
5

This can be done in Karabiner, but is counter-intuitive and turns common keyboard usage upside down (check the first sentences of Monomeeth's answer).

An example for [M+N] to F13 is already provided in the presets of Karabiner:

enter image description here

Mapping 1+0 to F16 would require to add the following snippet to private.xml:

<item>
  <name>Simultaneous Key Presses [0+1] to F16</name>
  <identifier>remap.simultaneouskeypresses_012f16</identifier>
  <autogen>__SimultaneousKeyPresses__ KeyCode::KEY_0, KeyCode::KEY_1, KeyCode::F16</autogen>
</item>

By defining an additional vk_lazy key (i.e. 0) it should also be possible to first press 0 and then 1 and depending on the first key up either send an F16 or write 01, which is a more comfortable behavior typing "shortcuts" on a keyboard.

  • can Karabiner shortcuts be set on a per app basis? – hyph Mar 9 '17 at 23:26
  • 1
    @hyph Sure, some apps are predefined in appdef.xml but you can add other ones. To restrict the above "shortcut" to Excel only, one would have to add <only>EXCEL</only> in the snippet (Excel is predefined!). – klanomath Mar 9 '17 at 23:32
  • You taught me something new about Karabiner. I had saw the [M+N] shortcut before I made my post, but I had wrongly assumed that this one, fixed combination was the only regular-key shortcut that Karabiner was capable of creating. I tested all 5 of the example shortcuts from my original post using your method, and Karabiner works flawlessly! Thank you! Also, I think that I now agree with your last sentence (the more that I think about it). (Notes to self: Insert the first custom item on the line below </root>. When editing the XML file, keep in mind that it is case-sensitive.) – rubik's sphere Mar 10 '17 at 11:13
  • This is a great solution. I like just how customisable Karabiner obviously is! – Monomeeth Mar 10 '17 at 11:30
2

I don't believe what you want to do is going to be possible if Karabiner can't do it.

The reason we have modifier keys (i.e. control, option, shift, and command) is that they need to modify the standard alphanumeric keys so that they're being recognised as something else besides their alphanumeric value. Let me explain this further:

  • When an alphanumeric key is pressed, its input is sent to the frontmost active application. So, if you have MS Word open and, using your first example keyboard shortcut: 1+0, pressing these keys will be recognised by MS Word as a '1' and '0' respectively unless their value is modified (e.g. by a modifier key).
  • But, what you want to effectively do, using your first example keyboard shortcut: 1+0 again as the example, is use the 1 key as the modifier key and/or the fact that both the 1 and 0 keys, if pressed simultaneously, represent something different to a '1' and '0'.
  • Now you can see why this may cause problems: If the 1 key is acting as a modifier key, then how do you get the active app to recognise a '1' when you need it to? Or, if you're wanting this to work only when the 1+0 keys are pressed simultaneously, what happens if either key is pressed ever so slightly before the other key? That's not simultaneous and therefore your input will be screwed up (so to speak).
  • So, to get this to work Karabiner (or some other utility) is going to have to be smart enough to manage this conundrum. As Thomas Tempelmann mentions in their comment below, one way to do this would be to add a delay after key presses so that the frontmost app doesn't recognise the key yet. But of course, any such delay is going to have to be very short (trust me - even a split second delay in something can cause users to feel a system is not being responsive).

You may want to refer to the: macOS Human Interface Guidelines - Keyboard Shortcuts page for a better understanding of Apple's guidelines to developers on this.

As an aside, when developers create games and a key is used for a specific purpose (e.g. the Z key moves the character left) the game is still recognising the Z key as a 'Z' but has just been programmed to accept the 'Z' value as meaning the character moves left.

Any software that appears to change the action of a key press (e.g. games that allow you to customise your controls, or utilities such as USB Overdrive, ControllerMate, etc) still accept the default key value rather than needing to modify them, and that's how they achieve their function.

For example, a user can use USB Overdrive to map a key (let's say the T key) to a particular function with or without the use of modifier keys, but when they're used without a modifier key they're still being recognised as having their original input. So I do not think they're going to be useful to you either, and of course, they're not designed to create keyboard shortcuts per se. However, you could check them out anyway (they're free to try) just in case you can trick either of them to do what you want:

Notes:

  1. I have used both USB Overdrive and ControllerMate, but do not have any association with them whatsoever.
  2. For what it's worth, ControllerMate offers more advanced functionality (but it is more difficult to master).
  3. You may want to contact Karabiner support or send the developer an email as I still think it's your best bet and may be able to do what you want.
  • As a developer, I find your explanation confusing. Wouldn't it be much clearer to say that using keys such as '0' and '1' as modifiers creates a problem because usually, when you press such a key, it's immediately forwarded to the front app as a typed key. Now, if you want to have 0+1 generated a different key, then the question is what shall happen if you press 0 slightly earlier than 1. How shall it know that 1 will soon follow, and thus NOT tell the front app that 0 has been pressed? Do you want to have all keys delayed all the time to make this work? If you can handle that, it might work. – Thomas Tempelmann Mar 10 '17 at 11:06
  • @ThomasTempelmann You are absolutely correct, my explanation wasn't very clear. Thanks for bringing that to my attention. :) Normally I would update my answer, but since it appears Klanomath has provided an explanation on how the OP can do what they want using Karabiner, I will be deleting this answer shortly as I don't think it really adds any value. Unless you think otherwise? – Monomeeth Mar 10 '17 at 11:29
  • @klanomath has informed me how to accomplish what I want in Karabiner. Karabiner works perfectly for every motley combo that I threw at it, which is terrific. BTW, the reason that I wanted this ability is because of my proclivity for convenient, one-handed keyboard shortcuts; I can execute them faster and with less deliberation. Opening up all of the regular keys dramatically expands the number of adjacent or near-adjacent keyboard shortcuts that I can assign. I take your point about the concept of modifier keys - shortcuts with a modifier key are certainly preferred. – rubik's sphere Mar 10 '17 at 11:31
  • @ThomasTempelmann You bring up important concerns. For my usage, as long as my cursor is not in a text field when I engage a shortcut (eg simultaneously pressing the A+D keys or the 1+0 keys), there are no side effects. If it is, I will simply have to click out of a text field before execution. Now, shortcuts that involve tab or the space bar are more problematic. But I don't actually plan on implementing any of these; they merely served as examples in my OP of the type of thing that I wanted to do. I'm sticking w/ letters/numbers/punctuation keys. But, yes, your second point is very true. – rubik's sphere Mar 10 '17 at 11:46
  • @Monomeeth Please don't delete your answer/comment. – klanomath Mar 10 '17 at 15:14
-2

iKey should do what you want to do.

  • Welcome to Ask Different! We're trying to find the best answers and those answers will provide info as to why they're the best. Explain why you think the answer you provided will solve the problem or is better than others out there. Providing links as supporting information can also help the OP, and others, find additional info for themselves. See How to Answer on how to provide a quality answer. – fsb Mar 10 '17 at 17:49

You must log in to answer this question.

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