How (edit: NOT) to Make Any Key a New Modifier Key

NOTE: This will not work properly in practice. See Peter's comment below for more information.

If you want to make a key work as a brand new modifier key (without just mapping it to some combination of existing modifier keys), you can do it easily with an if-else.

The example below makes C a hot key, and binds it to an if-else action. The if-else checks if the modifier key (F18 in the example) is held down. If it is, the action (Activate Google Chrome in the example) is executed. If the modifier key is not held down, then the Simulate Keystroke action is used to simulate the C keystroke. You have to do that, otherwise you wouldn't be able to use the C key normally.

Replace F18 with a different key to use something else as the modifier key.

Change C in both places to set up different keybindings that use the new modifier key.

Note: If the modifier key makes a "bonk" sound when you press it, you can create a macro that binds the key to no action. That will silence the key.

Note that simulating a key that is a hot key trigger has unpredictable behaviour. It will either trigger the macro or type the keystroke and which one happens will change depending on system load.

In your macro example, this will cause the macro to loop around many times triggering the macro, capturing the C, not seeing the F18, typing the C, triggering the macro, etc. Eventually, the C will likely get through as a character without triggering the macro. This may cause a delay in the C character happening.

Another consequence of capturing the key and then retyping it is that the key will be re-added to the end of the event queue. So that even without the above issue, you will get cases where you type fast enough that the C is added after other characters. This will be particularly prevalent with cases like “C H” which you probably type quite quickly, and which would then come out as “H C”.

1 Like

Argh man, that sucks. You’re right, of course. I just tried hitting C, H a bunch of times really fast, and some came out back to front. It looks like it’ll work, from reading the macro, and seemed to when I tried it, but yeah, I didn’t realise it was non-blocking and creates a race condition.

It would be really nice to be able to create new modifiers, without just binding the App key to (CtrlCmdShift) or whatever.

Thanks for letting us know, Peter. I’ll update the original post.

1 Like

One way would be to use a non-keyboard device like an XK-24 or such and use it as additional modifiers.

Yeah. The XK keypads are pretty cool. They’re quite expensive, but do look good.

I have an original Cherry G84-4700 Programmable Keypad. The old PS2 one can be programmed directly, using a PS2 keyboard attached to the daisychain port, The new USB one depends on Windows-only software (and doesn’t daisychain - the Windows driver can only handle one at a time anyway). Cherry sent me a complete set of relegendable keycaps for all the 1u keys too, so it’s not so different from the XK option. I might see if I can do something with that.

Thanks again, Peter.