kanata icon indicating copy to clipboard operation
kanata copied to clipboard

[Windows] japanese keyboard keycodes

Open kuapi0 opened this issue 3 years ago • 6 comments

I'm trying to configure on my japanese keyboard laptop. Only key that gets recognized is "ro" (the one on "/" right), which I have inserted in the cfg file as is, because KEY_RO wouldn't get recognized either. I'm missing KEY_MUHENKAN, KEY_HENKAN and KEY_YEN. Thanks in advance

kuapi0 avatar Sep 19 '22 09:09 kuapi0

Thanks for filling the issue! I'll look into these key mappings.

jtroo avatar Sep 19 '22 17:09 jtroo

Some notes for adding keymaps

  • kmonad's Windows key maps:
  , (KeyKatakana, 0x15)
  -- , (KeyHiragana, ???)
  , (KeyHenkan, 0x1C)
  , (KeyKatakanaHiragana, 0x15)
  , (KeyMuhenkan, 0x1D)
  • I believe the yen key is the US backslash; just need to add an alias for that. Linux appears to have a separate yen key, but I can't find anything about that mapping on Windows
  • can use KeyCode::Lang[3-9] keys in keyberon. May not be technically correct, but doesn't really matter as long as the OsCode<->KeyCode mapping is consistent.

jtroo avatar Sep 21 '22 08:09 jtroo

Hi @kuapi0, if you're able to test the branch in PR #145, that would be great. The key names in the configuration are:

        "\\" | "bksl" | "yen" => OsCode::KEY_BACKSLASH,
        "cnv" | "conv" | "henk" | "hnk" | "henkan" => OsCode::KEY_HENKAN,
        "ncnv" | "mhnk" | "muhenkan" => OsCode::KEY_MUHENKAN,

jtroo avatar Sep 22 '22 04:09 jtroo

Hey @jtroo, sorry for not replying sooner, been busy. Let me start by admitting I don't have the slightest idea how this all works haha Despite that, I managed to build the .exe and test with the .cfg I've attached. The exe now launches properly without throwing errors as before, however the keys still don't work. Let me know what testing I could do on my part, like if there's a tool for reading key events similar to xev in windows I could send you the logs. kanata.zip

kuapi0 avatar Sep 24 '22 12:09 kuapi0

I've also noticed something very strange: as you can see from the picture I attached, my keyboard presents a second small Left Alt between Ralt and print screen. In the previously attached .cfg file, I had to comment it out because I was getting a repeat declaration error. With that cfg Ralt gets ignored and the small Alt key sends the bksp I had intended for Ralt. I've been using kanata on my work laptop (italian ISO keyboard, US input) for a while and have never had any problem with Ralt getting ignored.

WhatsApp Image 2022-09-24 at 14 17 45

kuapi0 avatar Sep 24 '22 12:09 kuapi0

All good, thanks for the feedback! You can test kanata with the --trace flag to show more output. If you could test that and send me the logs alongside what key sequence you pressed, that would be helpful. Please send the output with both the alt issue as well as the japanese keys.

It should be noted though that some keys just may not work properly because Windows does the wrong thing. E.g. #127

jtroo avatar Sep 24 '22 22:09 jtroo