Waylandではキーボード配列の設定を各アプリケーションごとに行わせるため、どこで設定すればよいのかよくわからない。
WSLgはWaylandとそのコンポジタであるWestonを使用している(https://github.com/microsoft/wslg の「WSLg Architecture Overview」参照)。WSL上のLinuxで使用しているX Window アプリについても、XWaylandというデーモン経由でWaylandを利用するため、これまでのX.org用の設定が反映されない。
そして、WSLgでは、Windows側に接続されているキーボードの設定を利用して、Linux側の設定を無視してキーボードレイアウトを変更しているようなので、どこをいじればキーボードレイアウトを変更できるかわからない。
WSLgのwestonは初回のweston.ini設定のキーボード配列を保持しません。
ログを見ると途中で、
convert_rdp_keyboard_to_xkb_rule_names: matching model=pc105 layout=us variant=(null) options=(null)のような動作が行われており、 Windows側のキーボード配列にXのキーボード配列を合わせているようです。
WSLgのWestonは起動時に /home/wslg/.config/weston.ini という設定ファイルを読み込んでいるが、/home/wslgは私の環境に存在しない。
% more /mnt/wslg/weston.log Date: 2025-06-13 JST [17:57:09.975] weston 9.0.0 https://wayland.freedesktop.org Bug reports to: https://gitlab.freedesktop.org/wayland/weston/issues/ Build: 9.0.0-210-gf227edd6 [17:57:09.977] Command line: /usr/bin/weston --backend=rdp-backend.so --modules=wslgd-notify.so --xwayland --socket=wayl and-0 --shell=rdprail-shell.so --log=/mnt/wslg/weston.log --logger-scopes=log,rdp-backend,rdprail-shell [17:57:09.977] OS: Linux, 5.15.167.4-microsoft-standard-WSL2, #1 SMP Tue Nov 5 00:21:55 UTC 2024, x86_64 [17:57:09.977] warning: XDG_RUNTIME_DIR "/mnt/wslg/runtime-dir" is not configured correctly. Unix access mode must be 0700 (current mode is 777), and must be owned by the user (current owner is UID 1000). Refer to your distribution on how to get it, or http://www.freedesktop.org/wiki/Specifications/basedir-spec on how to implement it. [17:57:09.984] Using config file '/home/wslg/.config/weston.ini' [17:57:09.986] Output repaint window is 7 ms maximum. [17:57:09.987] Loading module '/usr/lib/libweston-9/rdp-backend.so' [17:57:09.996] using FreeRDP version 2.4.0 Date: 2025-06-13 JST ~以下略~
私の環境でもキーボード設定の読み替えをしている。私はWindows11にJIS配列のキーボードを接続している。
% grep convert_rdp_keyboard_to_xkb_rule_names /mnt/wslg/weston.log [17:57:15.315] convert_rdp_keyboard_to_xkb_rule_names: matching model=pc105 layout=jp variant=(null) options=(null) [18:20:17.347] convert_rdp_keyboard_to_xkb_rule_names: matching model=pc105 layout=jp variant=(null) options=(null) [18:35:49.023] convert_rdp_keyboard_to_xkb_rule_names: matching model=pc105 layout=jp variant=(null) options=(null)
Windows11でキーボード配列を英語配列に変更してみたところ、以下のようにUS配列となった。
% grep convert_rdp_keyboard_to_xkb_rule_names /mnt/wslg/weston.log [19:55:05.700] convert_rdp_keyboard_to_xkb_rule_names: matching model=pc105 layout=us variant=(null) options=(null)
fcitx5-configtoolの設定も、setxkbmapでの設定もキーボートレイアウトの設定に関しては関係ない。ただし、fcitx5-configtoolの設定は標準入力と日本語入力(Mozc)に切り替えるキーをどれにするのかには関係がある。