On the history and implementation of NumLock


(Jesse) #41

Ok. By my reading, that means that we’re now properly emulating what a regular keyboard does.While I understand that the behavior may not be desirable, it is at least not -broken-


(Jesse) #42

https://github.com/robbyrussell/oh-my-zsh/issues/2654#issuecomment-43887580 looks relevant


(Andrew Gallagher) #43

Weeeeeeeellll… sort of. But on a regular keyboard you can choose not to press NumLock. :slight_smile:


(Eddie Jinks) #44

The new behavior works perfectly on Windows. Nice change.


(Andrew Gallagher) #45

That did the trick! Thanks. Perhaps this should be featured in the documentation…


(Jesse) #46

Now that we know it works, totally. Since you’ve run through the process, would you be up for proposing what we should tell folks?


(Andrew Gallagher) #47

Sure. How much agonizing detail do we want? :wink:


(Jennifer Leigh) #48

Enough but not too much? :slight_smile: Feel free to sketch something out and I can test it and flesh it out on Windows and OSX.


(Jesse) #49

There is some value to putting both “here’s how to fix this issue” and “here’s an interesting doctoral dissertation on the history and societal implications of this problem” online, as the former is what most folks want and the latter is what will someday save someone six hours of agonizing research. :wink:

But the short version is probably the critical bit


(Eddie Jinks) #50

Random observation today while I was working and getting used to using NumLock to access the number pad more quickly… The quote key (2 spaces down from the num key) lights up red. I looked at the default legend that comes with the Model 01 and noticed that that key doesn’t have a NumLock assignment.

Through just a little digging, I found that this is due to the fact that the NumLock layer has Key_Quote assigned to that key and doesn’t just fall through to the base layer (also defined as Key_Quote). Was this intentional? Maybe we should just update the default sketch to have that key be transparent so it doesn’t light up red and confuse people.


(Andrew Gallagher) #51

Your Model01 should ensure that your computer’s NumLock mode is enabled when you activate the numeric keypad. On Windows and Linux, NumLock must be enabled for the keypad to generate digits. If your keypad is moving your cursor rather than generating digits, it is because NumLock is not being properly synchronised. This is a known problem in early versions of the firmware; to fix it please update to the latest version. (Insert reference to firmware upgrade instructions)

On Mac OS X, there is no such thing as NumLock. But since the Model01 can’t be 100% sure what sort of computer it is plugged into, it tries to enable NumLock anyway. Most Mac software will ignore this, however the following software has been known to behave oddly:

  • iTerm2 - When activating your Model01’s numpad, sometimes an escape sequence is sent and this can cause unusual behaviour in terminal programs such as bash and vi. To fix this, go to iTerm2 -> Preferences -> Profile -> Keys, click “Load preset” and choose “xterm with numeric keypad”.


(fluffy) #52

Blender uses it, unfortunately. As such, I have a dedicated external number pad for Blender.


(ScottB) #53

I’ve upgraded to the latest firmware, but I’m still having the problem. There is a complication here I should mention: I’ve moved ‘LockLayer(NUMPAD)’ to Fn-Num so I can use the Num key for Backslash/VerticalBar. Maybe that has something to do with it. But anyway, the first time I engaged the numpad after flashing the new firmware, I got digits as desired, but when I disengaged it, one of the modifier keys was stuck on; I think it was the right Control key. (I hadn’t seen that before.) And then, when I engaged the numpad again, I got arrow keys etc. instead of digits.

… Oh, this is interesting. According to ‘xev’, when I engage the numpad with Fn-Num, I get an ongoing stream of KeyPress/KeyRelease pairs with keycode 77, Num_Lock. As soon as I press another key, those stop and I get the press/release pair for the key I pressed; they don’t resume afterwards. And the last keycode 77 event is a KeyPress! And with a little more experimentation I see that the first one in the stream is actually a KeyRelease. So this is really a stream of KeyRelease/KeyPress event pairs.


(Andrew Gallagher) #54

I think you have to be careful choosing the positions for the layer changers. In particular, you should make sure that the layer changer is available both before and after numlock is engaged. Are you using the new layer order, where function is defined after numpad rather than before?


(Jesse) #55

Interesting! Can you see what happens if you stick the numlock toggle somewhere that’s visible on the map from within Numlock? Like possibly not making it a ___ key on the NUMPAD layout but instead being LockLayer(NUMPAD)?


(ScottB) #56

you should make sure that the layer changer is available both before and after numlock is engaged

Heheh, I thought of that :smile: Num on the numpad layer is ‘LockLayer(NUMPAD)’. Yes, I’m using the new layer order.


(ScottB) #57

Can you see what happens if you stick the numlock toggle somewhere that’s visible on the map from within Numlock? Like possibly not making it a ___ key on the NUMPAD layout but instead being LockLayer(NUMPAD)?

It is already, for the reason Andrew mentioned. Although, I guess it wouldn’t really be a problem if it weren’t; I’d just have to hit Fn-Num again to get back to the base layer. Let me try that…


(Jesse) #58

Also, do you see the weird behavior with the default keymap?


(ScottB) #59

Okay, I flashed the default keymap, and I did the endless stream of release/press pairs once. I think it was on the third try, though, and then I couldn’t get it to happen again, even after power-cycling the keyboard. But now I’ve switched back to my layout and it happens easily. Changing the numpad layer entry for Num back to ‘___’ seems to make no difference.

Hmm, this last time I tried it with ‘xev’, there was initially a KeyPress event with keycode 77, and then 500 ms [edit: actually 600 ms] later, the series of release/press pairs started.


(Jesse) #60

Would you mind opening a bug report at https://github.com/keyboardio/Kaleidoscope-NumPad/issues?

Oh. Wait. Is your sketch using Kaleidoscope-NumPad or Kaleidoscope-Numlock?