Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Onboarding - Detect german language keyboard layouts #200

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

f-rakete
Copy link

InputLanguageCheckDiffers() only checks agains intput language, but the input language might be non-german and the keyboard layout still is.

fixed with info from: https://stackoverflow.com/a/27747405

@f-rakete f-rakete changed the title Onboarding - Detect german language keyboard layouts Fix: Onboarding - Detect german language keyboard layouts Dec 14, 2024
@amadeo-alex
Copy link
Collaborator

Hello and thank you for the PR!
We've attempted something like this where if any of the installed languages (InstalledInputLanguages) are "german", the popup is shown - https://github.com/hass-agent/HASS.Agent/pull/74/files
The added code checks for "CurrentInputLanguage" - did you had a case where the InstalledInputLanguages check failed and the popup was not shown despite german KB layout being there?

@f-rakete
Copy link
Author

Hello and thank you for the PR!
We've attempted something like this where if any of the installed languages (InstalledInputLanguages) are "german", the popup is shown - https://github.com/hass-agent/HASS.Agent/pull/74/files
The added code checks for "CurrentInputLanguage" - did you had a case where the InstalledInputLanguages check failed and the popup was not shown despite german KB layout being there?

That's why I'm doing the pull request - i have win11 with English language but german keyboard layout and it didn't notify me 🙃

@amadeo-alex
Copy link
Collaborator

I did some tests and looks like it won't be that easy :D
The name (so for example the check for "German" that you did) depends on a system locale - I have a windows with a polish display language and two keyboard layouts, PL & ENG-UK. When I change the KB layout to ENG-UK one,
"InputLanguage.CurrentInputLanguage.LayoutName" resolves to "Zjednoczone Królestwo" which is basically "United Kingdom".

@amadeo-alex
Copy link
Collaborator

Even better, if I take a POL-PLP input culture info object and compare it to POL-DE object, they are "equal" :)
It just simply does name check and both have pl-PL name for some unknown to me reason.

@amadeo-alex
Copy link
Collaborator

amadeo-alex commented Dec 23, 2024

dotnet/winforms#8439
So yeah, it was merged to Winforms for .net 8 preview if I understand correctly...

@amadeo-alex
Copy link
Collaborator

I just had a nice head first dive into keyboard layouts on windows and oh boi, that's gonna be a nice adventure.
We'll basically need to recreate the code from the fix and then modify it a bit...
Sleep first tho :D

@amadeo-alex
Copy link
Collaborator

Would you be so kind to test this branch - https://github.com/amadeo-alex/HASS.Agent/tree/fix-german-keyboard2 ?

@f-rakete
Copy link
Author

f-rakete commented Jan 9, 2025

Would you be so kind to test this branch - https://github.com/amadeo-alex/HASS.Agent/tree/fix-german-keyboard2 ?

my InputLanguage.CurrentInputLanguage.Handle is 0x0000000004072000 so KnownOkInputLanguage doesn't catch it

keyboardLayoutIdName is "00000407"

so this check KnownNotOkKeyboardLayouts[keyboardLayoutLanguageId] finds it

summary:
that branch works on my machine 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants