randyrants / sharpkeys

SharpKeys is a utility that manages a Registry key that allows Windows to remap one key to any other key.
http://www.randyrants.com/
Microsoft Public License
6.15k stars 409 forks source link

'Type Key' recognizes incorrect Num Lock key #530

Closed nummacway closed 1 year ago

nummacway commented 1 year ago

On the several computers I own, Sharp Keys always fails to recognize the Num Lock key when I use the 'Type a Key' feature: image This is not just an incorrect name, it's an incorrect key: Remapping it will not do anything, but other keys learnt by that feature (I tested Caps Lock and Scroll Lock) do work, so does picking Num Lock from the list.

All computers tested have a German (Germany) locale and they were running Windows 10 22H2 (two computers), Windows 10 22H1 and Windows 7. I tried PS/2 and USB keyboards. However, I did only actually test remapping E0_45 on one Windows 10 22H2 computer with an USB keyboard.

DreymaR commented 1 year ago

The Special: NumLock key should have ordinary scan code (00_45). I can confirm that 'Type a key' incorrectly(?) registers my NumLock to as Special: € (E0_45).

Looks like some kind of bug?

randyrants commented 1 year ago

Some questions:

Thanks!

nummacway commented 1 year ago

By locale, I mean the Windows region and display language. The software-side keyboard layout is German as well. There are only two physical keyboard layouts in the world, ANSI and ISO, of which I used the latter on all my computers I tested. Except for very cheap imports and some cheap laptops, European keyboards are always ISO. I gave all other details in my OP.

randyrants commented 1 year ago

Thanks for the additional info; I also, re-read the OP, as I missed the answers to the bottom two questions.

My guess here is that the keyboard layout is translating the scancode somewhere in the Windows stack before it gets passed to SharpKeys. I've seen this happen, where I've connected a ja-JP or en-GB keyboard to a PC running en-US language/keyboard and it gets interesting, because it can vary. There are times when they key will respond based off its location, other times when it gives you what's on the label of the key, and other times when it just ignores you (because there's no en-US key equivalent, like the Kana key.) It's really, really messy when trying to code, because [ {, ] }, and /? are all over the place.

Not much I can do with this one, as I do not have the resources to try to shift the labels of the scancodes to map to the local keyboard changes, so I can't try that. It took at least 6 years before I got my hands on a keyboard with Alt+Gr to test some early attempts at mapping , but if people wanted to fork the codebase, they could start localizing it on their own.

Only other thing I could think to do is select the 00_45 by hand and export the Scancode Layout from the Registry for future use. If you always remap that key on every machine you touch, it's a lot easier than installing the app and setting the UI each time. I don't think I've run SharpKeys to remap my keys in a couple of years :)

HTH!

nummacway commented 1 year ago

If you still have the British one, that one should be ISO, which means it has a two-row Return key (L-shape) and an additional key between LShift and Z. I do not have an ANSI keyboard at hand, because Europeans can't create XML files with an ANSI one.

DreymaR commented 1 year ago

There are only two physical keyboard layouts in the world, ANSI and ISO, [...].

Oh no, that's wrong. There are Western form factors that adhere to neither standard (although they use the same scan code set), and there is the JIS for instance.

https://deskthority.net/wiki/ANSI_vs_ISO

European keyboards are always ISO.

Also wrong. The Czech Republic and Poland are counterexamples. I think it holds true for Western and Northern Europe, though.

Please don't claim falsehoods overconfidently.

Europeans can't create XML files with an ANSI one.

This one is also not entirely true. You're assuming that all European layouts have the <> symbols on their ISO key, which doesn't hold. Also, Europeans may easily use another system keyboard layout to produce these symbols, in addition to programs that let you type whatever you like with any underlying OS layout.