This is a follow-up thread to Key id symbols wanted - #25 by maexxx
I’ve created a python tool that attempts to auto-learn the host keymap: GitHub - mhantsch/uhk-learn-layout: Tools to enable an UltimateHackingKeyboard (uhk) to learn the keyboard layout of the host system
The idea is to get the UHK to understand the host keymap to be able to generate specific characters on the host system when the host is using a non-US keymap.
It would help all those users that use non-US keyboard layouts – for example those that buy a German labeled UHK, and then get confused when Agent shows them a US keyboard, and when they want to send a
/ character, they have to use
& (because that is the US symbol on Shift-7 where their German keycaps have the
/ symbol). Agent doesn’t even show them the labels they have on their actual keycaps. I think the UHK software can do better than that.
At the moment, the UHK knows it’s internal key ids (a fixed id for each hardware key), it understands scancodes (which are configurable in Agent), and it labels keys with key names according to the US layout. Those labels are mapped to the scancodes.
But also those key names are used in macro commands such as
tapKey, and here they are directly mapped to key ids (based on US layout positions) and do not undergo the scancode mapping.
You also have the host character that is produced by the host OS. (The scancode gets mapped to a character by the host keymap.) That’s a concept that currently is not anywhere in Agent or the UHK firmware. I believe it should be introduced.
Let’s assume we can somehow find out the key id to host character mapping, and load that into an in-memory table for the firmware to use. Maybe even with some macro commands:
set hostmap.<character> <keyid> <mods>
(or the other way around)
Then - as a starting point - I would introduce additional tapKey-like function, something like:
which would consult the hostmap first to convert character
y into the key id it needs to tap together with any modifiers (Shift, AltGr).
Send text commands would also allow to send hostmap-converted strings etc.
Maybe this is the starting point for a discussion how to get this done (in stages?).