AllanChain / blog

Blogging in GitHub issues. Building with Astro.
https://allanchain.github.io/blog/
MIT License
13 stars 0 forks source link

Enabling Numpad on a Windows Laptop without Numpad #171

Open AllanChain opened 3 years ago

AllanChain commented 3 years ago

View Post on Blog

Sometimes you really need a numpad. For example when inputing a large quantity of numbers after an insane physics experiment.


It is not very easy to find a good solution, because they are all talking about on screen keyboard. However it is not convinient.

If you have AutoHotkey installed, it is just a problem of writing a proper script to toggle key mapping: https://stackoverflow.com/questions/24389178

Copying the top answer's code:

mode := 0

^!m::
    mode:=!mode ;not! toggle
return

#If mode ; All hotkeys below this line will only work if mode is TRUE
    j::1
    k::2
    l::3
    u::4
    i::5
    o::6
#If

In case you are not familiar with ahk syntax (or I forget in the future):

Notice that the script above does not fully simulate numpad, it is sending normal number keys (keys on top) instead of numpad keys. To send numpad keys:

mode := 0

^!m::
    mode:=!mode ;not! toggle
return

#If mode ; All hotkeys below this line will only work if mode is TRUE
    j::Numpad1
    k::Numpad2
    l::Numpad3
    u::Numpad4
    i::Numpad5
    o::Numpad6
    7::Numpad7
    8::Numpad8
    9::Numpad9
    0::Numpad0
#If

But the use case is rare. The first script is enough for me.