Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you remap keys of a specific keyboard?

I've got two keyboards attached to my computer. A normal full-size keyboard and a numeric keypad. I want to "remap" the keys on the numeric keypad, but leave the full keyboard alone. So, when the user presses "5" on the keypad it would get remapped to the "Media Play" key, but if the same "5" was pressed on the keypad of the full keyboard, I'd get a "5". In essence, I want to turn that seperate numeric keypad into a media control device.

Unfortunately I'm not sure how to make this work. There is a "Raw Input" feature of Windows which allows to distinguish between keyboards, but that only allows to read the keys - not remap them. There are keyboard hooks (low level and high level) which can remap the keystrokes, but they don't distinguish between keyboards.

Can I make a combination of the two methods work? For that I'd have to be sure that the raw input message is processed before the keyboard hook kicks in. Is that so?

Also, I've read that Windows for some reason does not allow to use Raw Input and Keyboard Hooks in the same process. I could work around that by making 2 different processes, but that becomes more fragile because of communication latency (keyboard hooks have very limited time in which they must complete their work).

Is this doable at all?

like image 433
Vilx- Avatar asked Dec 06 '12 11:12

Vilx-


People also ask

Can I remap a second keyboard?

TL;DR You can connect two keyboards and remap the keys on second keyboard to anything (except ctrl/alt/shift+key combos).

How do I assign a SpaceBar to another key?

You could add a second additional Space Bar on the Right Ctrl key, as another option (you can have as many as you like), or you could use both Ctrl keys as Space Bars and make the SpaceBar a Ctrl key.


1 Answers

In the end it turned out I needed a custom keyboard driver to accomplish this. Fortunately I found one ready for taking - Interception. The app is ready and works perfectly. :)

like image 60
Vilx- Avatar answered Sep 19 '22 04:09

Vilx-