Skip to content

WSLGd: load keymap settings from .wslgconfig into weston.ini#1046

Open
fargiolas wants to merge 1 commit into
microsoft:mainfrom
fargiolas:user_weston_config
Open

WSLGd: load keymap settings from .wslgconfig into weston.ini#1046
fargiolas wants to merge 1 commit into
microsoft:mainfrom
fargiolas:user_weston_config

Conversation

@fargiolas
Copy link
Copy Markdown

Allow user to customize weston settings by providing a .weston.ini file in User Profile directory.

The idea is to give advanced users an easy way to configure a keymap to fallback to if weston rdp backend logic fails to find a mapping between current keyboard layout and XKB ones. See microsoft/weston-mirror#144 for further details.

@hideyukn88
Copy link
Copy Markdown
Member

Hi. we don't want to expose weston.ini directly from Windows side, this is why we have exposed only certain configuration via .wslgconfig. If the configuration of default keyboard is necessary, please expose it via .wslgconfig, thanks!

Introduce a new "weston-keyboard" section in .wslgconfig where you can
configure weston/xkb keymap settings that will be used as a fallback if
no xkb mapping can be found for current keyboard layout.

Syntax is the same of weston.ini(5). Only keymap related key-value
pairs are imported into WSLG system weston.ini, anything else is
ignored.
@fargiolas fargiolas force-pushed the user_weston_config branch from 716a1b1 to c4b1453 Compare April 30, 2023 09:11
@fargiolas
Copy link
Copy Markdown
Author

@hideyukn88 see the new commit, it should address your concerns.

The idea is to add a new [weston-keyboard] (or whichever name you like) section in .wslgconfig where you can configure keymap settings that will be merged into wslg weston.ini when WSLGd starts and used as a fallback when keyboard layout mapping fails.

This way only keymap related settings are merged into weston.ini instead of exposing the full config file to the user.

This obviously depends on microsoft/weston-mirror#144 being merged as at the moment "us" layout is hardcoded in the rdp backend if layout mapping fails.

@fargiolas fargiolas changed the title WSLGd: load user weston.ini WSLGd: load keymap settings from .wslgconfig into weston.ini Apr 30, 2023
@fargiolas
Copy link
Copy Markdown
Author

@hideyukn88 any feedback on the latest proposed changes? now that the other PR has been merged (thanks!) it would definitely make life easier for us custom layout users

@hideyukn88
Copy link
Copy Markdown
Member

@fargiolas, currently we are evaluating the idea to have /etc/wslg.conf, similar to WSL's /etc/wsl.conf, inside user-distro filesystem, so we could do this utilizing that, so please hold on, thanks!

@fargiolas
Copy link
Copy Markdown
Author

@fargiolas, currently we are evaluating the idea to have /etc/wslg.conf, similar to WSL's /etc/wsl.conf, inside user-distro filesystem, so we could do this utilizing that, so please hold on, thanks!

That would be great! Thanks for the update!

@cassiocsantana
Copy link
Copy Markdown

I'm looking forward to this update

@Ckln
Copy link
Copy Markdown

Ckln commented May 16, 2025

Same 👀

LunarWatcher added a commit to LunarWatcher/dotfiles that referenced this pull request Jun 24, 2025
Custom keyboard layouts do not propagate to WSL GUI apps:
* microsoft/wslg#173 - initial report
    * Also microsoft/wslg#1184, and many other
      instances
* microsoft/wslg#1046 - attempt to fix with a
    windows-native config file that isn't wiped on boot, never followed
    up on by Microsoft. It's been two years since they said "we'll get
    back to you". I wonder if MS operates on 6-8 business years rather
    than 6-8 business weeks

WSL/WSLg is an outright joke. I've spent more time configuring _basic_
features in WSL than I've spent configuring my entire daily driver Linux
distro, and working around bugs that have existed since 2019 without
being addressed:
    microsoft/WSL#4197

How anyone can use WSL without being constantly pissed by bugs and
unimplemented (but critical) features continues to amaze me
@benhillis benhillis added keyboard-layout enhancement New feature or request labels May 17, 2026
@benhillis
Copy link
Copy Markdown
Member

Triage note (2026-05): Thanks for the patch and apologies for the long silence. This needs a rebase against main (GitHub is reporting merge conflicts) and a refresh against current WSLGd/main.cpp. Are you still interested in shepherding this through? If we don't hear back in 30 days I'll close it out and you (or anyone else) can reopen with a fresh branch.

The companion microsoft/weston-mirror#144 is also part of this work and would need to land first.

@fargiolas
Copy link
Copy Markdown
Author

Hi @benhillis

I am still interested in solving this but I think it is waiting for a design decision from your side.

Currently it is possible to change weston keyboard layout injecting a custom weston.ini from wsl bash profile, something like:

wsl.exe --user root --system bash -c "grep -q keyboard
/home/wslg/.config/weston.ini" 2> /dev/null
weston_updated=$?

if [ "$weston_updated" -eq 1 ]; then
wsl.exe --user root --system bash -c "cat << EOF >>
/home/wslg/.config/weston.ini

[keyboard]
keymap_layout=us
keymap_variant=altgr-intl

EOF" 2> /dev/null
wsl.exe --user root --system pkill -HUP weston 2> /dev/null
fi

As long as this keeps working I am fine, I guess it's up to you to decide if you want to expose a saner way to configure wslg, weston or just the keyboard section.

The other PR (microsoft/weston-mirror#144), that makes the above workaround possible, is already merged since quite a while.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request keyboard-layout

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants