Closed HiiGHoVuTi closed 1 year ago
It depends what operating system you're using and on Windows, which input mechanism you're using (standard vs. interception).
On Windows with the standard input mechanism, and assuming your OS keyboard layout is set correctly, you will probably just want to make defsrc look like your physical keyboard's appearance and probably don't need any deflocalkeys configuration.
For context, @HiiGHoVuTi is on nixos.
I assume the evdev module just gives kanata the physical keypresses, which I assume would also mean defsrc should look like the physical keyboard?
Sure but most characters require special treatment (deflocalkeys)
and that is the source of my problem.
The whole numrow is &é"'(-è_çà)= most of these characters are a problem for the config file.
How do I know how to define the local keys ?
For context, @HiiGHoVuTi is on nixos.
I assume the evdev module just gives kanata the physical keypresses, which I assume would also mean defsrc should look like the physical keyboard?
My understanding is that the USB codes sent by keyboards map to the QWERTY layout for most keys regardless of the symbols displayed. This should be visible, and should confirm in evtest. So the physical keyboard is kinda lying, but operating systems ask what keys you have (or are preset based on country) to remap in the operating system level. But Kanata will receive the equivalent of usb codes, so pressing the key with the A symbol on the AZERTY keyboard will send Q to Kanata. Confusing 😅
There are a few options. You could map the QWERTY layout in defsrc. Or you could use evtest and define the changed keys with capitals. E.g. (fake numbers, don't use this)
(deflocalkeys
A 12
Z 13
)
(defsrc
A Z e r t y .....
.....
)
Building on the previous idea, you could map all evtest codes and use all capital letters. It will be more time consuming but more consistent, so probably less error prone and confusing.
For posterity, evtest should be suggested as a tool for this here: https://github.com/jtroo/kanata/blob/main/docs/config.adoc#non-us-keyboards
On an unrelated note (I am attempting to use a qwerty layout to see what happens), now it is telling me I need to add kanata to the uinput group. The example config I was following did not do that, they only had their user in that group.
@HiiGHoVuTi are you not using the nixos module? I assume that does this for you
This is all the kanata configuration I have
services.kanata = {
enable = true;
keyboards.redox = {
config = builtins.readFile ./keyboard.kbd;
devices = ["/dev/input/by-id/..."];
};
};
It does work with qwerty ! Now when I remap things, I have to write the qwerty equivalent to it maps to the right thing ?
(deflayer dvorak
@grl 1 2 3 4 5 6 7 8 9 0 [ ] bspc
tab ' , . p y f g c r l / = \
@cap a o e u i d h t n s - ret
lsft ; q j k x b m w v z rsft
lctl lmet lalt spc ralt rmet rctl
)
On this layer, when I press a
it types q
(deflayer dvorak @grl 1 2 3 4 5 6 7 8 9 0 [ ] bspc tab ' , . p y f g c r l / = \ @cap a o e u i d h t n s - ret lsft ; q j k x b m w v z rsft lctl lmet lalt spc ralt rmet rctl )
On this layer, when I press
a
it typesq
The OS is doing another layer of remapping still. You could set your keyboard layout in the OS layer to US or US International depending on what you need.
Otherwise you'll have to remap with the knowledge of what keycode you need kanata to output for the OS to translate it to the actual desired keysym (e.g. in this case would be q in that position I think)
So to use kanata (with some keyboards) you have to give all the keyboard control to it and disable your OS's keyboard mappings and set it to US (or US international), right ? I will try this tomorrow and close the issue if it worked.
So to use kanata (with some keyboards) you have to give all the keyboard control to it and disable your OS's keyboard mappings and set it to US (or US international), right ? I will try this tomorrow and close the issue if it worked.
It's not strictly necessary. Some users use kanata with cyricllic alphabets and there it is required to use OS level remapping. But doing what you describe can make configuration simpler.
Internationalisation stuff is complicated haha.
I've seen this link on how to use kanata with a QWERTZ iso keyboard, but I still can't quite figure out how to
defsrc
my azerty keyboard correctly. Any help ?