Skip to content

Draft: fix: xcb_xkb_get_names reply always returns "us" layout

Hi All,

this should fix: #257

What I learned is that until a key is pressed the XServer internally still uses its "core keyboard" as the master keyboard and this core keyboard uses the hardcoded layout of "us".

I was super unsure how much logic I should put into the lookupInitLayout function so I decided to start with the minimal approach of returning the first found "XkbLayout" from the config files. I started working on this because of sddm (https://github.com/sddm/sddm/issues/202#issuecomment-133628462). I configured my layouts on my machine with following command localectl set-x11-keymap "de,us" pc105 "" grp:win_space_toggle. Which then creates following config file:

Section "InputClass"
       Identifier "system-keyboard"
       MatchIsKeyboard "on"
       Option "XkbLayout" "de,us"
       Option "XkbModel" "pc105"
       Option "XkbOptions" "grp:win_space_toggle"
EndSection

I was thinking about changing lookupInitLayout to not stop at the first "XkbLayout" but search all of them and look for the Identifier "system-keyboard" but then I maybe couple the XServer a bit too much to the localectl so I decided to go with the simplest approach.

Unfortunately I can only test it with my local startx environment because I was unable to connect my self build Xorg with the sddm on my machine. But the tests I did in my environment looked very promising so I am confident that this should fix the issue.

This is my first commit to a FOSS project so feel free to suggest any changes ;) I tried to keep the style consistent with the rest of the file (that's why I put no comments)

Kind Regards Michael

Merge request reports