microsoft / PowerToys

Windows system utilities to maximize productivity
MIT License
110.86k stars 6.53k forks source link

Lock the numeric keypad to always and forever use numbers #1196

Open titoBouzout opened 4 years ago

titoBouzout commented 4 years ago

Summary of the new feature/enhancement

The numeric keypad has two states, use like numbers or use like idk navigation and idk what else. I wanna just use the numbers and I want it to never ever again change to anything else than numbers. Is very annoying it keeps changing.

Proposed technical implementation details (optional)

Just lock it in the numeric keypad state and prevent any state switch, forever. Thank you!

crutkas commented 4 years ago

OMG YES!

titoBouzout commented 4 years ago

I would like to expand and give some reasons for this:

  1. The very obvious one, most people expect that thing to just enter numbers on the screen, if you press and no number is seen and the cursor moves weird then you are into problems.

  2. The other that isnt that obvious, people that don't speak English does some keyboard gymnastics with ALT+NUMBERS to type some characters that aren't currently on the keyboard. Like ñ @ etc.....

  3. Developers do something similar to the second point, for example Spanish keyboard has the special keys > < to the left of the Z but English keyboards don't have it. So if you use an english keyboard(like most imported[sic] laptops this days) with a Spanish setup you have to resort to stuff like ALT+62 and ALT+60. Dont make me tell you what you have to do to type regular expressions like ^ [] { } etc......

  4. This is a new reason for me, my keyboard just broke, so the 7 key(Numeric keypad one) is not working properly, whenever I hit it, it drives me crazy because I never know if I turned ON Num Lock on or not as the key misbehave! And thats why I entered this issue..... lol

bzoz commented 4 years ago

It looks like there is no Windows way to lock the num-lock key. We can, however (at least I think this should work):

This is a great thing for a first-time contribution. A new, separate, small powertoy.

titoBouzout commented 4 years ago

Well, here is a temporal AHK script courtesy of @boredofnames


#NoEnv
#InstallKeybdHook
SetNumLockState, AlwaysOn
Lexikos commented 4 years ago

unfortunately, if PT are not running as admin, we won't be able to intercept NumLock keys in elevated apps.

If PT utilized the uiAccess="true" attribute in its manifest (and met all of the requirements for that), it would be possible for PT to intercept keystrokes destined for elevated apps when PT itself is not running as admin. The requirements and effects of this attribute are documented under Security Considerations for Assistive Technologies.

jmahlers commented 4 years ago

If the key remapper supported mapping a key to nothing, this functionality could be built into the existing module. I suppose it matters whether the goal is to make the numpad always output numbers or to stop Num Lock from actuating.

Right now if you attempt to select none, there is a popup stating "Shortcuts must contain an action key". If instead selecting none just intercepted the keypress, I think that'd be a clean solution.

I haven't contributed to open source before, but I've looked at the contributor's guide and I'd be interested in trying to implement that.

Jay-o-Way commented 4 years ago

Can't you just break the NumLock key out of your keyboard?

htcfreek commented 4 years ago

Well, here is a temporal AHK script courtesy of @boredofnames


#NoEnv
#InstallKeybdHook
SetNumLockState, AlwaysOn

Did this also prevent Numkock from state change while booting up a VM with Windows 10? Can the user enable NumLock within the VM when the state change is blocked on the host?

dixonte commented 3 years ago

Since my suggestion is very similar to this, I'd like to add here that I would very much like if we could do the same thing with caps lock. I'd like to be able to keep it (almost) always off, possibly with Win+CapsLock turning it on until either turned off again or the system idles for a set period of time.

holodrum commented 2 years ago

+1 for what dixonte said, let us permanently enable caps and num lock (and even scroll lock for that matter).

It's such a waste of keys, I don't know a single person that uses them for their intended purpose, either people just never press them, or, like me, they have remapped both keys to other keys as to not waste two keys that are located (especially caps lock) at areas you often use on the keyboard.

udobehm commented 2 years ago

Does it work? Can someone teach me how I always keep the num lock key enabled?

titoBouzout commented 2 years ago

@udobehm yes it works, download autohotkey https://www.autohotkey.com/ then create a file named "numlock.ahk" with content

#NoEnv
#InstallKeybdHook
SetNumLockState, AlwaysOn

right click the file and choose "compile script", it will create an exe file, that you can run and also add to windows start up

udobehm commented 2 years ago

Thanks - will try this out

vamsivadrevu commented 1 year ago

Does this still need help implementing? I'd like to take this up as it is marked as Good First issue.

Jay-o-Way commented 1 year ago

@vamsivadrevu what's your idea/solution?

taiottavios commented 8 months ago

Well, here is a temporal AHK script courtesy of @boredofnames

#NoEnv
#InstallKeybdHook
SetNumLockState, AlwaysOn

this is cool but it will interfere with keyboard lighting, I tried already. It would be nice to have the default set to numbers (indicator light or special lighting scheme shut off) instead of navigation, which is very weird anyway

wallach-game commented 1 month ago

Hello, im from CZ, we use this weird symbols like čěšáčěšč xDD.
Some websites just interpretes ř as 5, or % to 5 for example (2fa auth). at least for 60% keyboard kayouts.

this is example char map const charToNumberMap = { '0': '0', '1': '1', '2': '2', '3': '3', '4': '4', '5': '5', '6': '6', '7': '7', '8': '8', '9': '9', '`': '1', '±': '1', '¡': '1', '²': '2', '³': '3', '£': '4', '$': '5', '%': '5', '¥': '5', '€': '5', '₣': '5', '@': '2', '#': '3', '§': '5', '&': '7', '*': '8', '(': '9', ')': '0', '-': '1', '=': '1', '[': '1', ']': '1', '{': '1', '}': '1', ';': '1', '\'': '1', ',': '2', '.': '3', '/': '4', '\': '1', '|': '1', ':': '1', '"': '1', '<': '7', '>': '8', '?': '4', '¡': '1', '¿': '5', '´': '5', '¸': '5', 'ˇ': '5', '˘': '5', '°': '1', '˙': '1', '˛': '5', 'ϴ': '5', 'ρ': '5', 'α': '1', 'β': '2', 'γ': '3', 'δ': '4', 'ε': '5', 'ζ': '6', 'η': '7', 'θ': '8', 'ι': '9', 'κ': '0', 'λ': '1', 'μ': '2', 'ν': '3', 'ξ': '4', 'ο': '5', 'π': '6', 'ρ': '7', 'σ': '8', 'τ': '9', 'υ': '0', 'φ': '1', 'χ': '2', 'ψ': '3', 'ω': '4', 'Ά': '1', 'Έ': '2', 'Ί': '3', 'Ό': '4', 'Ύ': '5', 'Ή': '6', 'Ϊ': '7', 'Ϋ': '8', 'Α': '1', 'Β': '2', 'Γ': '3', 'Δ': '4', 'Ε': '5', 'Ζ': '6', 'Η': '7', 'Θ': '8', 'Ι': '9', 'Κ': '0', 'Λ': '1', 'Μ': '2', 'Ν': '3', 'Ξ': '4', 'Ο': '5', 'Π': '6', 'Ρ': '7', 'Σ': '8', 'Τ': '9', 'Υ': '0', 'Φ': '1', 'Χ': '2', 'Ψ': '3', 'Ω': '4', 'А': '1', 'Б': '2', 'В': '3', 'Г': '4', 'Д': '5', 'Е': '6', 'Ё': '7', 'Ж': '8', 'З': '9', 'И': '0', 'Й': '1', 'К': '2', 'Л': '3', 'М': '4', 'Н': '5', 'О': '6', 'П': '7', 'Р': '8', 'С': '9', 'Т': '0', 'У': '1', 'Ф': '2', 'Х': '3', 'Ц': '4', 'Ч': '5', 'Ш': '6', 'Щ': '7', 'Ь': '8', 'Ы': '9', 'Ъ': '0', 'Э': '1', 'Ю': '2', 'Я': '3', 'А': '1', 'Б': '2', 'В': '3', 'Г': '4', 'Д': '5', 'Е': '6', 'Ё': '7', 'Ж': '8', 'З': '9', 'И': '0', 'Й': '1', 'К': '2', 'Л': '3', 'М': '4', 'Н': '5', 'О': '6', 'П': '7', 'Р': '8', 'С': '9', 'Т': '0', 'У': '1', 'Ф': '2', 'Х': '3', 'Ц': '4', 'Ч': '5', 'Ш': '6', 'Щ': '7', 'Ь': '8', 'Ы': '9', 'Ъ': '0', 'Э': '1', 'Ю': '2', 'Я': '3', // Add more mappings as needed for additional characters and symbols }; (generated, so im not sure it its corect)