1

I created a custom keyboard layout with Microsoft Keyboard Layout Creator (MSKLC) for my Windows 10 machine. The custom keyboard layout is based on the Swiss German Layout and the numbers are swapped with symbols. After the installation of the new layout, it works fine. I have two options to install it:

  1. Register a completely new keyboard layout on the system and select it in the keyboard settings, or
  2. Replace the Keyboard-Layout-DLL file on Windows/System32 with the newly created layout (e.g. Swiss French since I never use it) and select the Swiss-French keyboard layout in the settings

On the same machine, I also use Ubuntu with WSL. However, I don't use Windows Terminal to access the shell but I use gnome-terminal via WSLg (X11 / Wayland). Everything started via WSLg seems to recognize the selected Keyboard Layout (e.g. Swiss French) but it applies the corresponding keyboard layout which is installed on the Linux system; so it's not the custom layout but the original Swiss-French layout.

MSKLC generates a KLC file but I'm not sure how I can convert it and replace the Swiss-French layout on Ubuntu with it. I didn't have luck with KLFC to do this. Basically, I need to apply the same changes for the Swiss-French layout on my Ubuntu machine (WSL).

Or would it be easier to register a completely new layout (option 1) and also create a completely new one for Ubuntu? But how are they linked to each other then? How does Windows tell the selected keyboard layout to WSLg?

2 Answers 2

2

I think at the moment your only chance is to create a new layout directly in Ubuntu. There has been a issue for a while now that the keyboard mapping of wslg does not support custom layouts: #173

For me on Windows 11 it got worse for a few weeks now: If I use the custom layout, wslg falls back to the English layout and completely ignores AltGr - I don't even have the chance to remap it because for Ubuntu it's not physically available anymore.

1

There is a workaround by installing x11-xkb-utils in WSL

sudo apt install x11-xkb-utils

Next, run the following commands (or add them to your .bashrc or .profile)

WAYLAND_DISPLAY="wayland-1"
setxkbmap -model abnt2 -layout br -variant abnt2
WAYLAND_DISPLAY="wayland-1"

In this example, abnt2 (for the Portuguese language) is set.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .