How do you emulate PC numlock on macos?

164 views
Skip to first unread message

John Feiler

unread,
Nov 1, 2020, 12:20:15 PM11/1/20
to Karabiner
I just found Karabiner, and it looks super useful, but there's something I've always wanted to do that I haven't found a way to do, and I'm hoping that Karabiner will do the trick.

It is my understanding that the keycode sent from the numeric keypad number keys  changes depending on whether or not the numlock key is pressed. This behavior is used (legitimately for at least two different ARPG games) to autocast certain spells. The way this works is that if you press and hold the numlock-7 key, for example, it sends a keydown event, but if you then press numlock and then release the numlock-7 key, it sends a *different* keycode for the keyup event... and since the app doesn't get the keyup event, it thinks the key is still down, so it continues to cast the spell mapped to that key.

I've looked through the list of existing complex mappings, and I didn't see anything obvious that would do what I want by default. Any ideas?

J

John Feiler

unread,
Nov 1, 2020, 1:04:47 PM11/1/20
to Karabiner
I hate to answer my own question with another question, but I found the "Keypad as Arrows" complex action on https://ke-complex-modifications.pqrs.org/?q=keypad, and I think I understand what it's doing (it turns the keypad_num_lock key into a toggle, setting an internal variable, then it sends different key codes from the numpad keys based on that variable's value), but I'm not sure where to find information on what key codes are possible to send. I presume it's not arbitrary, and that there's an enum somewhere.

Is there an easy way to debug custom complex modifications? I see the console, but I don't see any way to set debug mode or something similar

John Feiler

unread,
Nov 1, 2020, 1:37:10 PM11/1/20
to Karabiner
OK, answering my own question with another question again. I found Karabiner-EventViewer which confirmed my understanding of the example I found. I Have the numpad clear key set to toggle the variable Num Luck, and the numpad 7 key sends either numpad_7 or home based on the value of the variable. But regardless of the state of the variable, the key for the key_up event is always the same as the key_down event. Is there a way to change that? In other words, to have the key_up event key value correspond to the value specified in the variable even if that doesn't match the value of the previous key_down event? (Yeah, I know that's weird, but it's the way that PC keyboards work, and it's the feature that is used by the autocast trick I mentioned earlier).

Thanks!
J

Reply all
Reply to author
Forward
0 new messages