keymanapp / keyman

Keyman cross platform input methods system running on Android, iOS, Linux, macOS, Windows and mobile and desktop web
https://keyman.com/
Other
403 stars 112 forks source link

feat(windows): Install keyboards and registering TIPs identified only by BCP47 tag - proof of concept #12510

Open rc-swag opened 1 month ago

rc-swag commented 1 month ago

An upcoming change to Windows 11 improves the way TIPs is registered with both the language and the keyboard ID. This will mean no more issues with LCID and transient IDs for unsupported languages. This feature is available in the insider edition of Windows 11 behind a feature flag.

This issue is to change Keyman to use this update using the InstallLayoutOrTip. It does not need to support the current implementation using PowerShell cmd line calls.

This replaces the need for the ticket increasing the Transient language ids to 9422
Extra notes:

To turn the featur on use Vivetool /enable /id:34912776 https://www.makeuseof.com/enable-new-keyboard-layouts-windows-11/

rc-swag commented 2 weeks ago

The current status is there needs to be more work done at the Microsoft end before this is ready. I will move this to 19.0 Here is a summary of what we can do. Extra information:

First set the following feature flags.

34762752 (InputSupportForBcp47)

34912776 (KSOD)

48433719 (UxAccOptimization) ??? Not sure we needed this one

Then have tried multiple scenarios, using both the InstallLayoutOrTip API in a small program, and using Set-WinUserLanguageList which calls InstallLayoutOrTip.

Example 1.

Here we tried adding arc-Armi-IR BCP 47 locale, and after installing, the InputMethodTips array just seems to be empty. However, a new keyboard does often appear in the language picker, but not in HKCU\Control Panel\International.

$list_new = Get-WinUserLanguageList

$list_new.add("arc-Armi-IR")

echo $list

…

LanguageTag     : arc-Armi-IR

Autonym         :

EnglishName     : Official Aramaic (700-300 BCE) (arc-Armi-IR)

LocalizedName   :

ScriptName      : Imperial Aramaic

**InputMethodTips : {ARC-ARMI-IR:00000409}**

Spellchecking   : True

Handwriting     : False

…

Set-WinUserLanguageList -f $list_new

Get-WinUserLanguageList

…

LanguageTag     : arc-Armi-IR

Autonym         :

EnglishName     : Official Aramaic (700-300 BCE) (arc-Armi-IR)

LocalizedName   :

ScriptName      : Imperial Aramaic

**InputMethodTips : {}**

Spellchecking   : True

Handwriting     : False

…

Example 2.

Trying to add a TIP never seems to work – the new locale + TIP does not appear in the language picker, nor in HKCU\Control Panel\International.

$list_new = Get-WinUserLanguageList

$list_new.add("arc-Armi-IR")

$list_new[2].InputMethodTips.clear()

$list_new[2].InputMethodTips.add('arc-Armi-IR:{FE0420F1-38D1-4B4C-96BF-E7E20A74CFB7}{6A9CDAB4-A949-4987-8224-345D0150D399}')
Where FE0420F1… is the Keyman CLSID, 6A9CDAB4… is the profile guid

echo $list_new

…

LanguageTag     : arc-Armi-IR

Autonym         :

EnglishName     : Official Aramaic (700-300 BCE) (arc-Armi-IR)

LocalizedName   :

ScriptName      : Imperial Aramaic

**InputMethodTips : {arc-Armi-IR:{FE0420F1-38D1-4B4C-96BF-E7E20A74CFB7}{6A9CDAB4-A949-4987-8224-345D0150D399}}**

Spellchecking   : True

Handwriting     : False

…

Set-WinUserLanguageList -f $list_new

Get-WinUserLanguageList

…

LanguageTag     : arc-Armi-IR

Autonym         :

EnglishName     : Official Aramaic (700-300 BCE) (arc-Armi-IR)

LocalizedName   :

ScriptName      : Imperial Aramaic

**InputMethodTips : {}**

Spellchecking   : True

Handwriting     : False

…

We also tried not clearing the InputMethodTips first. We tried a number of other BCP 47 codes. Also, the information in Settings often did not match what Get-WinUserLanguageList showed us. So the in-memory state seemed different from the windows registry.