diff --git a/Flow.Launcher.Core/Resource/LocalizationConverter.cs b/Flow.Launcher.Core/Resource/LocalizationConverter.cs index 1d835a831..81600e023 100644 --- a/Flow.Launcher.Core/Resource/LocalizationConverter.cs +++ b/Flow.Launcher.Core/Resource/LocalizationConverter.cs @@ -4,7 +4,7 @@ using System.Globalization; using System.Reflection; using System.Windows.Data; -namespace Flow.Launcher.Core +namespace Flow.Launcher.Core.Resource { public class LocalizationConverter : IValueConverter { diff --git a/Flow.Launcher.Core/Resource/LocalizedDescriptionAttribute.cs b/Flow.Launcher.Core/Resource/LocalizedDescriptionAttribute.cs index af8b23136..52a232334 100644 --- a/Flow.Launcher.Core/Resource/LocalizedDescriptionAttribute.cs +++ b/Flow.Launcher.Core/Resource/LocalizedDescriptionAttribute.cs @@ -1,7 +1,6 @@ using System.ComponentModel; -using Flow.Launcher.Core.Resource; -namespace Flow.Launcher.Core +namespace Flow.Launcher.Core.Resource { public class LocalizedDescriptionAttribute : DescriptionAttribute { diff --git a/Flow.Launcher/Converters/TranslationConverter.cs b/Flow.Launcher.Core/Resource/TranslationConverter.cs similarity index 81% rename from Flow.Launcher/Converters/TranslationConverter.cs rename to Flow.Launcher.Core/Resource/TranslationConverter.cs index e1e8a58e3..ebab99e5b 100644 --- a/Flow.Launcher/Converters/TranslationConverter.cs +++ b/Flow.Launcher.Core/Resource/TranslationConverter.cs @@ -1,11 +1,10 @@ using System; using System.Globalization; using System.Windows.Data; -using Flow.Launcher.Core.Resource; -namespace Flow.Launcher.Converters +namespace Flow.Launcher.Core.Resource { - public class TranlationConverter : IValueConverter + public class TranslationConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { diff --git a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs index 09fad990b..9ae1748da 100644 --- a/Flow.Launcher.Infrastructure/UserSettings/Settings.cs +++ b/Flow.Launcher.Infrastructure/UserSettings/Settings.cs @@ -147,6 +147,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings /// 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 000000000..0bff23fe1 --- /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/CustomShortcutSetting.xaml b/Flow.Launcher/CustomShortcutSetting.xaml index bbf6ff9f2..5a40a77b1 100644 --- a/Flow.Launcher/CustomShortcutSetting.xaml +++ b/Flow.Launcher/CustomShortcutSetting.xaml @@ -64,7 +64,6 @@ Copy Cut Paste + Undo + Select All File Folder Text @@ -59,6 +61,8 @@ Node.js Path Please select the Node.js executable Please select pythonw.exe + Always Start Typing in English Mode + Temporarily change your input method to English mode when activating Flow. Auto Update Select Hide Flow Launcher on startup @@ -69,7 +73,7 @@ Search with Pinyin Allows using Pinyin to search. Pinyin is the standard system of romanized spelling for translating Chinese. Always Preview - Always open preview panel when Flow starts. Press F1 to toggle preview. + Always open preview panel when Flow starts. Press F1 to toggle preview. Shadow effect is not allowed while current theme has blur effect enabled diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index 9f8d523e0..095382e76 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 3a15fea8a..70ce7876b 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -3,6 +3,7 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:converters="clr-namespace:Flow.Launcher.Converters" + xmlns:core="clr-namespace:Flow.Launcher.Core.Resource;assembly=Flow.Launcher.Core" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:flowlauncher="clr-namespace:Flow.Launcher" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" @@ -42,7 +43,7 @@ - + @@ -737,30 +738,14 @@ - - -  - - - - - - - - - - + ToolTip="{DynamicResource AlwaysPreviewToolTip}" /> -  +  @@ -943,13 +928,52 @@ Text="{Binding Settings.PluginSettings.PythonExecutablePath, TargetNullValue='None'}" />