diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 09fad990bdd..9ae1748daff 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -147,6 +147,7 @@ public CustomBrowserViewModel CustomBrowser /// public bool ShouldUsePinyin { get; set; } = false; public bool AlwaysPreview { get; set; } = false; + public bool AlwaysStartEn { get; set; } = false; [JsonInclude, JsonConverter(typeof(JsonStringEnumConverter))] public SearchPrecisionScore QuerySearchPrecision { get; private set; } = SearchPrecisionScore.Regular; diff --git a/Flow.Launcher/Converters/BoolToIMEConversionModeConverter.cs b/Flow.Launcher/Converters/BoolToIMEConversionModeConverter.cs new file mode 100644 index 00000000000..0bff23fe178 --- /dev/null +++ b/Flow.Launcher/Converters/BoolToIMEConversionModeConverter.cs @@ -0,0 +1,55 @@ +using System; +using System.Globalization; +using System.Windows.Data; +using System.Windows.Input; + +namespace Flow.Launcher.Converters +{ + internal class BoolToIMEConversionModeConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value is bool v) + { + if (v) + { + return ImeConversionModeValues.Alphanumeric; + } + else + { + return ImeConversionModeValues.DoNotCare; + } + } + return ImeConversionModeValues.DoNotCare; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } + + internal class BoolToIMEStateConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value is bool v) + { + if (v) + { + return InputMethodState.Off; + } + else + { + return InputMethodState.DoNotCare; + } + } + return InputMethodState.DoNotCare; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index d0bdfee9b2c..3350a449924 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -55,6 +55,8 @@ Select the file manager to use when opening the folder. Default Web Browser Setting for New Tab, New Window, Private Mode. + Always Start Typing in English Mode + Temporarily change your input method to English mode when activating Flow. Python Directory Auto Update Select diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index 9f8d523e018..095382e76fc 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -9,6 +9,7 @@ xmlns:svgc="http://sharpvectors.codeplex.com/svgc/" xmlns:ui="http://schemas.modernwpf.com/2019" xmlns:vm="clr-namespace:Flow.Launcher.ViewModel" + d:DataContext="{d:DesignInstance Type=vm:MainViewModel}" Name="FlowMainWindow" Title="Flow Launcher" MinWidth="{Binding MainWindowWidth, Mode=OneWay}" @@ -37,6 +38,8 @@ + + @@ -204,6 +207,8 @@ PreviewKeyUp="QueryTextBox_KeyUp" Style="{DynamicResource QueryBoxStyle}" Text="{Binding QueryText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" + InputMethod.PreferredImeConversionMode="{Binding StartWithEnglishMode, Converter={StaticResource BoolToIMEConversionModeConverter}}" + InputMethod.PreferredImeState="{Binding StartWithEnglishMode, Converter={StaticResource BoolToIMEStateConverter}}" Visibility="Visible"> @@ -244,6 +249,7 @@ + - - -  - - - - - - - - - - + ToolTip="{DynamicResource AlwaysPreviewToolTip}" /> -  +  @@ -943,13 +927,52 @@ Text="{Binding Settings.PluginSettings.PythonDirectory, TargetNullValue='No Setting'}" />