microsoft / microsoft/PowerToys
Support key remapping for keyboards that uses a separate HID device for non-standard keys
- Dominant language
- C
- Stars
- 139k
- Forks
- 8.6k
- PR merge metrics
- PR metrics pending
Description
### Description of the new feature / enhancement
The specific problem I want to solve is the ability to remap all the keys on my Microsoft Natural Ergonomic Keyboard 4000, including the favorite keys, and the "My Favorites" star key itself.
### Scenario when this would be used?
The Microsoft Mouse and Keyboard Center application only allows mapping the favorite keys to launch an application. It doesn't allow remapping them to hot keys. Some "keys" such as the zoom slider can only be disabled if you don't want that behavior and has no ability to make it do something else.
### Supporting information
The additional HID device(s) can be discovered using the Win32 api GetRawInputDeviceList and enumerating the devices with type RIM_TYPEHID. You can register for windows input events using RegisterRawInputDevices. The Microsoft ergonomic keyboard has a usage page 0xc (Consumer controls), and a collection usage ID of 1. I suspect beyond the setup to start receiving events for the HID device, there would be very little change in the rest of the code except maybe registering some new keycode names as key presses will still arrive via WM_INPUT messages.
An AutoHotKey v1 implementation is [here as a useful reference](https://github.com/PolarGoose/AutoHotKey-Natural-Ergonomic-Keyboard-4000-support/) of a working api call sequence to achieve this.
Contributor guide
Research direction
Start with GetRawInputDeviceList, RegisterRawInputDevices, and WM_INPUT, using the linked AutoHotKey implementation as the behavioral reference. Confirm how PowerToys currently discovers keyboard input and define coverage for the Microsoft Natural Ergonomic Keyboard 4000's Consumer controls (usage page 0xc, collection 1), including favorite keys and the zoom slider. Done means those controls can be remapped as hot keys.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- desktop, operating-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100