diff --git a/Flow.Launcher.Infrastructure/Win32Helper.cs b/Flow.Launcher.Infrastructure/Win32Helper.cs index c84c2e3a8..7a3a0c36e 100644 --- a/Flow.Launcher.Infrastructure/Win32Helper.cs +++ b/Flow.Launcher.Infrastructure/Win32Helper.cs @@ -464,19 +464,18 @@ namespace Flow.Launcher.Infrastructure // https://github.com/dotnet/winforms/pull/8573#issuecomment-1542600949 // // NOTE: this logic may break in future versions of Windows since it is not documented. - if (langId is (int)PInvoke.LOCALE_TRANSIENT_KEYBOARD1 - or (int)PInvoke.LOCALE_TRANSIENT_KEYBOARD2 - or (int)PInvoke.LOCALE_TRANSIENT_KEYBOARD3 - or (int)PInvoke.LOCALE_TRANSIENT_KEYBOARD4) + if (langId is PInvoke.LOCALE_TRANSIENT_KEYBOARD1 + or PInvoke.LOCALE_TRANSIENT_KEYBOARD2 + or PInvoke.LOCALE_TRANSIENT_KEYBOARD3 + or PInvoke.LOCALE_TRANSIENT_KEYBOARD4) { - using RegistryKey key = Registry.CurrentUser.OpenSubKey(UserProfileRegistryPath); - if (key is not null && key.GetValue("Languages") is string[] languages) + using var key = Registry.CurrentUser.OpenSubKey(UserProfileRegistryPath); + if (key?.GetValue("Languages") is string[] languages) { foreach (string language in languages) { - using RegistryKey subKey = key.OpenSubKey(language); - if (subKey is not null - && subKey.GetValue("TransientLangId") is int transientLangId + using var subKey = key.OpenSubKey(language); + if (subKey?.GetValue("TransientLangId") is int transientLangId && transientLangId == langId) { return language;