Add determining keyboard layout from Wayland#1807
Conversation
aaf3a75 to
97d2312
Compare
|
Thank you so much @iansw246 for this important contribution! I tested it on my Ubuntu 24.04 machine having a German and English layout. For me, Plover always uses the German layout when selecting Even when setting my keyboard to Apart from that problem, the detected German layout does work. One question: Have you tested how Plover reacts when the Given my limited knowledge in this area, I'm not able to a thorough review. @LilleAila do you possibly have time to look into this approach? |
|
LGTM from a glance at the code. I think it is olah that this only applies to wayland as that is what the uinput output was primaily intended from. I have switched to MacOS since initially writing the output layer, but i can see if i can get it working on my secondary computer. Other than that it looks good (apart from the issue @mkrnr mentioned) and it seems like it is ready to merge. Although i haven’t tested it personally, i didn’t see anything specific in the code that i disagree with. |
|
Thanks a lot @LilleAila! @iansw246 there's now some minor conflicts since #1812 also modified the |
97d2312 to
3e9a17c
Compare
|
@iansw246 let me know when the PR is ready to be merged |
|
@mkrnr About the multiple layouts, there's not a way to detect which layout is active over Wayland without receiving the key events themselves. Plover always assumes the first layout is active. I'll add a warning in the UI before merging. Is there somewhere else this be documented too? Plover will crash without libxkcommon if it tries to use Uinput. I'll work on fixing that later. If you think supporting that use case is important, we can wait until that's fixed as well. |
|
@iansw246 thanks! Maybe you find a place in the docs regarding selecting the first layout but a note in the UI is already very good. I'd suggest not relying on tooltips though since not everyone reads them. You can decide if you want to fix the crash when libxkcommon is missing now or later. I can't really judge how common that situation would be. |
da0cbee to
94d49df
Compare
94d49df to
6dd63e4
Compare
|
Added text below the keyboard layout selection. Should be good to merge now. I will fix the libxkbcommon crash another time. |
mkrnr
left a comment
There was a problem hiding this comment.
Thanks for adding the info text! Tested it on Ubuntu and it works as expected.
Summary of changes
Adds a Linux keyboard layout option "wayland-auto" that retrieves the current keyboard layout from the running Wayland compositor. Uses the xkbcommon package to parse the keymap, as well as to generate the other keyboard layout options.
Solves #1726 but only for Wayland users.
Another limitation is that keyboard capture isn't using the retrieved layout. This means keyboard modifiers other than the standard QWERTY keys (for example mapping CapsLock to Ctrl) won't be handled properly when passing through keyboard shortcuts. This issue exists currently so new issues shouldn't be added and this PR should be ready to merge.
Pull Request Checklist
Changes have testsLinux specific changes