rvaiya / keyd

A key remapping daemon for linux.
MIT License
2.57k stars 156 forks source link

Cannot map some keys #193

Closed jean-tissot closed 2 years ago

jean-tissot commented 2 years ago

It seems impossible to map some keys if the physical keyboard layout doesn't match the keys defined in the keys.c file.
For example if the dollar ($) key is defined in its own key (and not in the 4 key) it seems impossible to map it
image

rvaiya commented 2 years ago

There is no such thing as a "physical $ key", S-4 gets converted into the symbol by your display server's key map, which I assume you've changed. You can use S-<key> instead ($ is just an alias for S-4). I would recommend using a standard US layout in your display server and making any changes within keyd to avoid this sort of confusion. I intend to document this better moving forward.

jean-tissot commented 2 years ago

Is there a solution for (french) azerty keyboards (which do not have the dollar key on 4 but on a dedicated key) without using a standard US layout (it would force me to remap many keys) ? My problem is that I can't reference the dollar key (S-4 is '4' and 4 is '-' in azerty keyboards) so I can't map it (I want to map A-$ to end to have a vim-like mode).
Can we, for example, reference a key with its keycode ?

rvaiya commented 2 years ago

How do you access this key normally on an AZERTY layout? keyd operates at the level of the key code, so you need to figure out what keycodes your display server key map uses to produce $ and map them in keyd. You can discover this using keyd -m and pressing the combination that normally produces $.

Eyeballing some images I've found online, I believe it should be S-], since ] seems to correspond to the £ position on french keyboards.

rvaiya commented 2 years ago

To elaborate, keyd uses key code names based on a standard US qwerty keyboard (originally the same names used in the kernel). The names themselves correspond to positions (i.e they represent key codes) which may have different physical markings on them if they are for a non-english market. The display server then translates these into symbols based on the current layout.

The key thing to remember is that the physical markings on the board bear no correspondence to the code they emit. This is done entirely in software. In other words s in keyd corresponds to code 31 which produces z if your display server layout is set to azerty.

This means if you are using a non-english/US layout you will have to figure out what the corresponding key names are. I may add support for some kind of layout file to do this kind of translation automatically at some point.

jean-tissot commented 2 years ago

How do you access this key normally on an AZERTY layout? keyd operates at the level of the key code, so you need to figure out what keycodes your display server key map uses to produce $ and map them in keyd. You can discover this using keyd -m and pressing the combination that normally produces $.

Eyeballing some images I've found online, I believe it should be S-], since ] seems to correspond to the £ position on french keyboards.

Thanks, I successfully mapped the dollar key, referencing it with ']' image

So, for others like me who don't use a standard US keyboard, the keyd -m command is very useful to get the name of the key

rvaiya commented 2 years ago

Yes, I should probably better document this :P. keyd was originally intended for the QMK crowd, who probably have a better understanding of the pitfalls.

jean-tissot commented 2 years ago

Thanks a lot !