Skip to content

Commit 39fccb5

Browse files
authored
Merge pull request #3426 from onesounds/250405-KoreanIME
Korean IME Infobar
2 parents d06a803 + 7192319 commit 39fccb5

File tree

8 files changed

+531
-9
lines changed

8 files changed

+531
-9
lines changed

Flow.Launcher.Infrastructure/Win32Helper.cs

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.ComponentModel;
3+
using System.Diagnostics;
34
using System.Globalization;
45
using System.Runtime.InteropServices;
56
using System.Windows;
@@ -517,5 +518,92 @@ public static bool IsNotificationSupported()
517518
}
518519

519520
#endregion
521+
522+
#region Korean IME
523+
524+
public static bool IsWindows11()
525+
{
526+
return RuntimeInformation.IsOSPlatform(OSPlatform.Windows) &&
527+
Environment.OSVersion.Version.Build >= 22000;
528+
}
529+
530+
public static bool IsKoreanIMEExist()
531+
{
532+
return GetLegacyKoreanIMERegistryValue() != null;
533+
}
534+
535+
public static bool IsLegacyKoreanIMEEnabled()
536+
{
537+
object value = GetLegacyKoreanIMERegistryValue();
538+
539+
if (value is int intValue)
540+
{
541+
return intValue == 1;
542+
}
543+
else if (value != null && int.TryParse(value.ToString(), out int parsedValue))
544+
{
545+
return parsedValue == 1;
546+
}
547+
548+
return false;
549+
}
550+
551+
public static bool SetLegacyKoreanIMEEnabled(bool enable)
552+
{
553+
const string subKeyPath = @"Software\Microsoft\input\tsf\tsf3override\{A028AE76-01B1-46C2-99C4-ACD9858AE02F}";
554+
const string valueName = "NoTsf3Override5";
555+
556+
try
557+
{
558+
using RegistryKey key = Registry.CurrentUser.CreateSubKey(subKeyPath);
559+
if (key != null)
560+
{
561+
int value = enable ? 1 : 0;
562+
key.SetValue(valueName, value, RegistryValueKind.DWord);
563+
return true;
564+
}
565+
}
566+
catch (System.Exception)
567+
{
568+
// Ignored
569+
}
570+
571+
return false;
572+
}
573+
574+
public static object GetLegacyKoreanIMERegistryValue()
575+
{
576+
const string subKeyPath = @"Software\Microsoft\input\tsf\tsf3override\{A028AE76-01B1-46C2-99C4-ACD9858AE02F}";
577+
const string valueName = "NoTsf3Override5";
578+
579+
try
580+
{
581+
using RegistryKey key = Registry.CurrentUser.OpenSubKey(subKeyPath);
582+
if (key != null)
583+
{
584+
return key.GetValue(valueName);
585+
}
586+
}
587+
catch (System.Exception)
588+
{
589+
// Ignored
590+
}
591+
592+
return null;
593+
}
594+
595+
public static void OpenImeSettings()
596+
{
597+
try
598+
{
599+
Process.Start(new ProcessStartInfo("ms-settings:regionlanguage") { UseShellExecute = true });
600+
}
601+
catch (System.Exception)
602+
{
603+
// Ignored
604+
}
605+
}
606+
607+
#endregion
520608
}
521609
}

Flow.Launcher/Languages/en.xaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,19 @@
113113
<system:String x:Key="searchDelayNumberBoxToolTip">Enter the wait time (in ms) until input is considered complete. This can only be edited if Search Delay is enabled.</system:String>
114114
<system:String x:Key="searchDelayTime">Default Search Delay Time</system:String>
115115
<system:String x:Key="searchDelayTimeToolTip">Wait time before showing results after typing stops. Higher values wait longer. (ms)</system:String>
116+
<system:String x:Key="KoreanImeTitle">Information for Korean IME user</system:String>
117+
<system:String x:Key="KoreanImeGuide">
118+
The Korean input method used in Windows 11 may cause some issues in Flow Launcher.&#x0a;
119+
If you experience any problems, you may need to enable "Use previous version of Korean IME".&#x0a;&#x0a;
120+
Open Setting in Windows 11 and go to:&#x0a;
121+
Time &amp; Language &gt; Language &amp; Region &gt; Korean &gt; Language Options &gt; Keyboard - Microsoft IME &gt; Compatibility,&#x0a;
122+
and enable "Use previous version of Microsoft IME".&#x0a;&#x0a;
123+
</system:String>
124+
<system:String x:Key="KoreanImeOpenLink">Open Language and Region System Settings</system:String>
125+
<system:String x:Key="KoreanImeOpenLinkToolTip">Opens the Korean IME setting location. Go to Korean &gt; Language Options &gt; Keyboard - Microsoft IME &gt; Compatibility</system:String>
126+
<system:String x:Key="KoreanImeOpenLinkButton">Open</system:String>
127+
<system:String x:Key="KoreanImeRegistry">Use Previous Korean IME</system:String>
128+
<system:String x:Key="KoreanImeRegistryTooltip">You can change the Previous Korean IME settings directly from here</system:String>
116129

117130
<!-- Setting Plugin -->
118131
<system:String x:Key="searchplugin">Search Plugin</system:String>
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
<UserControl
2+
x:Class="Flow.Launcher.Resources.Controls.InfoBar"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:cc="clr-namespace:Flow.Launcher.Resources.Controls"
6+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
7+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8+
xmlns:ui="http://schemas.modernwpf.com/2019"
9+
d:DesignHeight="45"
10+
d:DesignWidth="400"
11+
mc:Ignorable="d">
12+
<UserControl.Resources />
13+
<Grid>
14+
<Border
15+
x:Name="PART_Border"
16+
MinHeight="48"
17+
Padding="18 18 18 18"
18+
Background="{DynamicResource InfoBarInfoBG}"
19+
BorderBrush="{DynamicResource Color03B}"
20+
BorderThickness="1"
21+
CornerRadius="5">
22+
<Grid>
23+
<Grid.ColumnDefinitions>
24+
<ColumnDefinition Width="Auto" />
25+
<ColumnDefinition Width="*" />
26+
<ColumnDefinition Width="Auto" MinWidth="24" />
27+
</Grid.ColumnDefinitions>
28+
<StackPanel Grid.Column="0" Orientation="Horizontal">
29+
<Border
30+
x:Name="PART_IconBorder"
31+
Width="16"
32+
Height="16"
33+
Margin="0 0 12 0"
34+
VerticalAlignment="Top"
35+
CornerRadius="10">
36+
<ui:FontIcon
37+
x:Name="PART_Icon"
38+
Margin="1 0 0 1"
39+
VerticalAlignment="Center"
40+
FontFamily="Segoe MDL2 Assets"
41+
FontSize="13"
42+
Foreground="{DynamicResource Color01B}"
43+
Visibility="Visible" />
44+
</Border>
45+
46+
</StackPanel>
47+
<StackPanel
48+
x:Name="PART_StackPanel"
49+
Grid.Column="1"
50+
VerticalAlignment="Center"
51+
Orientation="Horizontal">
52+
<TextBlock
53+
x:Name="PART_Title"
54+
Margin="0 0 12 0"
55+
FontWeight="SemiBold"
56+
Foreground="{DynamicResource Color05B}"
57+
Text="{Binding RelativeSource={RelativeSource AncestorType=cc:InfoBar}, Path=Title}" />
58+
<TextBlock
59+
x:Name="PART_Message"
60+
Foreground="{DynamicResource Color05B}"
61+
Text="{Binding RelativeSource={RelativeSource AncestorType=cc:InfoBar}, Path=Message}"
62+
TextWrapping="Wrap" />
63+
</StackPanel>
64+
65+
<Button
66+
x:Name="PART_CloseButton"
67+
Grid.Column="2"
68+
Width="32"
69+
Height="32"
70+
VerticalAlignment="Center"
71+
AutomationProperties.Name="Close InfoBar"
72+
Click="PART_CloseButton_Click"
73+
Content="&#xE10A;"
74+
FontFamily="Segoe MDL2 Assets"
75+
FontSize="12"
76+
ToolTip="Close"
77+
Visibility="Visible" />
78+
</Grid>
79+
</Border>
80+
</Grid>
81+
</UserControl>

0 commit comments

Comments
 (0)