Skip to content
1 change: 1 addition & 0 deletions Flow.Launcher.Infrastructure/UserSettings/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ public CustomBrowserViewModel CustomBrowser
/// </summary>
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;
Expand Down
2 changes: 2 additions & 0 deletions Flow.Launcher/Languages/en.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
<system:String x:Key="defaultFileManagerToolTip">Select the file manager to use when opening the folder.</system:String>
<system:String x:Key="defaultBrowser">Default Web Browser</system:String>
<system:String x:Key="defaultBrowserToolTip">Setting for New Tab, New Window, Private Mode.</system:String>
<system:String x:Key="typingStartEn">Always Start Typing in English Mode</system:String>
<system:String x:Key="typingStartEnTooltip">Temporarily change your input method to English mode when activating Flow.</system:String>
<system:String x:Key="pythonDirectory">Python Directory</system:String>
<system:String x:Key="autoUpdates">Auto Update</system:String>
<system:String x:Key="selectPythonDirectory">Select</system:String>
Expand Down
1 change: 1 addition & 0 deletions Flow.Launcher/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@
</TextBox>
</Grid>
</Border>

<StackPanel
x:Name="ClockPanel"
IsHitTestVisible="False"
Expand Down
21 changes: 21 additions & 0 deletions Flow.Launcher/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
using System.Runtime.CompilerServices;
using Microsoft.VisualBasic.Devices;
using Microsoft.FSharp.Data.UnitSystems.SI.UnitNames;
using NLog.Targets;
using YamlDotNet.Core.Tokens;
using Key = System.Windows.Input.Key;

namespace Flow.Launcher
{
Expand Down Expand Up @@ -128,6 +131,7 @@ private void OnLoaded(object sender, RoutedEventArgs _)
UpdatePosition();
PreviewReset();
Activate();
QueryTextBox_StartEn();
QueryTextBox.Focus();
_settings.ActivateTimes++;
if (!_viewModel.LastQuerySelected)
Expand Down Expand Up @@ -191,6 +195,9 @@ private void OnLoaded(object sender, RoutedEventArgs _)
case nameof(Settings.Language):
UpdateNotifyIconText();
break;
case nameof(Settings.AlwaysStartEn):
QueryTextBox_StartEn();
break;
case nameof(Settings.Hotkey):
UpdateNotifyIconText();
break;
Expand Down Expand Up @@ -696,5 +703,19 @@ private void QueryTextBox_KeyUp(object sender, KeyEventArgs e)
be.UpdateSource();
}
}

private void QueryTextBox_StartEn()
{
if (_settings.AlwaysStartEn)
{
QueryTextBox.SetValue(InputMethod.PreferredImeConversionModeProperty, ImeConversionModeValues.Alphanumeric);
QueryTextBox.SetValue(InputMethod.PreferredImeStateProperty, InputMethodState.Off);
}
else
{
QueryTextBox.ClearValue(InputMethod.PreferredImeConversionModeProperty);
QueryTextBox.ClearValue(InputMethod.PreferredImeStateProperty);
}
}
}
}
63 changes: 43 additions & 20 deletions Flow.Launcher/SettingWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -737,30 +737,14 @@
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource AlwaysPreview}" />
<TextBlock Style="{DynamicResource SettingSubTitleLabel}" Text="{DynamicResource AlwaysPreviewToolTip}" />
</StackPanel>
<CheckBox
IsChecked="{Binding Settings.AlwaysPreview}"
Style="{DynamicResource SideControlCheckBox}"
ToolTip="{DynamicResource AlwaysPreviewToolTip}" />
<TextBlock Style="{StaticResource Glyph}">
&#xe8a1;
</TextBlock>
</ItemsControl>
</Border>

<Border Margin="0,30,0,0" Style="{DynamicResource SettingGroupBox}">
<ItemsControl Style="{StaticResource SettingGrid}">
<StackPanel Style="{StaticResource TextPanel}">
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource ShouldUsePinyin}" />
<TextBlock Style="{DynamicResource SettingSubTitleLabel}" Text="{DynamicResource ShouldUsePinyinToolTip}" />
</StackPanel>
<ui:ToggleSwitch
Grid.Column="2"
FocusVisualMargin="5"
IsOn="{Binding Settings.ShouldUsePinyin}"
IsOn="{Binding Settings.AlwaysPreview}"
Style="{DynamicResource SideToggleSwitch}"
ToolTip="{DynamicResource ShouldUsePinyinToolTip}" />
ToolTip="{DynamicResource AlwaysPreviewToolTip}" />
<TextBlock Style="{StaticResource Glyph}">
&#xe98a;
&#xe8a1;
</TextBlock>
</ItemsControl>
</Border>
Expand Down Expand Up @@ -943,13 +927,52 @@
Text="{Binding Settings.PluginSettings.PythonDirectory, TargetNullValue='No Setting'}" />
<Button
Height="34"
Margin="10,10,18,10"
Margin="10,0,18,0"
Click="OnSelectPythonDirectoryClick"
Content="{DynamicResource selectPythonDirectory}" />
</StackPanel>
</ItemsControl>
</Border>

<Border Margin="0,30,0,0" Style="{DynamicResource SettingGroupBox}">
<ItemsControl Style="{StaticResource SettingGrid}">
<StackPanel Style="{StaticResource TextPanel}">
<TextBlock
Grid.Column="1"
VerticalAlignment="Center"
Style="{DynamicResource SettingTitleLabel}"
Text="{DynamicResource typingStartEn}" />
<TextBlock Style="{DynamicResource SettingSubTitleLabel}" Text="{DynamicResource typingStartEnTooltip}" />
</StackPanel>
<ui:ToggleSwitch
Grid.Column="2"
FocusVisualMargin="5"
IsOn="{Binding Settings.AlwaysStartEn}"
Style="{DynamicResource SideToggleSwitch}" />
<TextBlock Style="{StaticResource Glyph}">
&#xe8d3;
</TextBlock>
</ItemsControl>
</Border>

<Border Margin="0,4,0,0" Style="{DynamicResource SettingGroupBox}">
<ItemsControl Style="{StaticResource SettingGrid}">
<StackPanel Style="{StaticResource TextPanel}">
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource ShouldUsePinyin}" />
<TextBlock Style="{DynamicResource SettingSubTitleLabel}" Text="{DynamicResource ShouldUsePinyinToolTip}" />
</StackPanel>
<ui:ToggleSwitch
Grid.Column="2"
FocusVisualMargin="5"
IsOn="{Binding Settings.ShouldUsePinyin}"
Style="{DynamicResource SideToggleSwitch}"
ToolTip="{DynamicResource ShouldUsePinyinToolTip}" />
<TextBlock Style="{StaticResource Glyph}">
&#xe98a;
</TextBlock>
</ItemsControl>
</Border>

<Border Style="{DynamicResource SettingGroupBox}">
<ItemsControl Style="{StaticResource SettingGrid}">
<StackPanel Style="{StaticResource TextPanel}">
Expand Down