wsldl-pg / ArchW-docs

ArchWSL documentation project
https://git.io/arch-doc
Creative Commons Attribution 4.0 International
54 stars 22 forks source link

How to set keymap in archWSL #18

Closed olesendan closed 2 years ago

olesendan commented 2 years ago

Hi.

I'm trying to set keymap in archlinux.

Ive tried to two approaches

  1. echo "keymap=us" >> /etc/vconsole.conf + echo "source /etc/vconsole.conf > ~/.bashrc
  2. change LANG and LANGUAGE in /etc/locale.conf to en_us.UTF-8.

either way do not work.

So is there a way to set keymap in archWSL

Greetings from Denmark Dan Olesen

koumaza commented 2 years ago

It might work when enabled Systemd. Please follow this: https://wsldl-pg.github.io/ArchW-docs/Known-issues/#wsl2

yuk7 commented 2 years ago

Where keymap used? Command window? or WSLg? VNC? or etc..?

The command window is a Windows implementation, and I think that setting is used. I think WSL is a VM container and the keyboard is used only indirectly.

olesendan commented 2 years ago

Hi Thank you for your answers.

I'm using the terminal inside WSL. Running in Windows Terminal. My scenario is: Windows 10 with a keyboard with danish layout. WSL2 with archWSL installed. On this host I would like to use a keyboard with US layout.

So I have tried to set the keymap inside the ArchWSL host. Is this wrong?

Greetings from Denmark Dan Olesen

yuk7 commented 2 years ago

Yeah,, That part (terminal window) is handled by the Windows OS. If you are physically using a different keyboard, you can set KeyboardTypeOverride of the registry.

but I hope that helps. yuk7

koumaza commented 2 years ago

@olesendan So I have tried to set the keymap inside the ArchWSL host. Is this wrong?

That is not wrong. Normally, keyboard input as scan code goes directly to Linux kernel. Linux kernel then maps scan code to a key code and sends it to Console, Display, etc. But in WSL, keyboard input as scan code goes to Hyper-V through NT Kernel. Then Hyper-V sends input as key code to Linux Kernel. Or NT Kernel sends key code to Console Host, Windows Terminal etc. Therefore, NT kernel needs to be configured to map the scan code as intended.

Set in here. (Screenshot) ![screenshot0](https://user-images.githubusercontent.com/44153315/126053662-f4b8bd12-3f5e-458e-a595-578ffcb2a18f.png) ![screenshot1](https://user-images.githubusercontent.com/44153315/126053739-8b1c002f-000b-4f8f-823f-fba4b9e99e94.png)
olesendan commented 2 years ago

Thank you.

Changed keyboard layout on the windows side, and it is working.

Greetings from Denmark Dan olesen

On Sun, 18 Jul 2021, 04.27 shanghai yakisoba chan!, < @.***> wrote:

@olesendan https://github.com/olesendan So I have tried to set the keymap inside the ArchWSL host. Is this wrong?

That is not wrong. Normally, keyboard input as scan code goes directly to Linux kernel. Linux kernel then maps scan code to a key code and sends it to Console, Display, etc. But in WSL, keyboard input as scan code goes to Hyper-V through NT Kernel. Then Hyper-V sends input as key code to Linux Kernel. Therefore, NT kernel needs to be configured to map the scan code as intended. Set in here. (Screenshot)

[image: screenshot0] https://user-images.githubusercontent.com/44153315/126053662-f4b8bd12-3f5e-458e-a595-578ffcb2a18f.png [image: screenshot1] https://user-images.githubusercontent.com/44153315/126053739-8b1c002f-000b-4f8f-823f-fba4b9e99e94.png

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/wsldl-pg/ArchW-docs/issues/18#issuecomment-881987403, or unsubscribe https://github.com/notifications/unsubscribe-auth/AI67KZGRQVU7SCS6B27RNN3TYI3XPANCNFSM5AGOMJPQ .

koumaza commented 2 years ago

We glad helped you☺️