mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Add AutoComplete Hotkey Item
This commit is contained in:
parent
2339941008
commit
22021c10ee
5 changed files with 62 additions and 6 deletions
|
|
@ -20,6 +20,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings
|
|||
public bool ShowOpenResultHotkey { get; set; } = true;
|
||||
public double WindowSize { get; set; } = 580;
|
||||
public string PreviewHotkey { get; set; } = $"F1";
|
||||
public string AutoCompleteHotkey { get; set; } = $"F2";
|
||||
|
||||
public string Language
|
||||
{
|
||||
|
|
|
|||
|
|
@ -46,7 +46,6 @@
|
|||
<Window.InputBindings>
|
||||
<KeyBinding Key="Escape" Command="{Binding EscCommand}" />
|
||||
<KeyBinding Key="F5" Command="{Binding ReloadPluginDataCommand}" />
|
||||
<KeyBinding Key="Tab" Command="{Binding AutocompleteQueryCommand}" />
|
||||
<KeyBinding
|
||||
Key="Tab"
|
||||
Command="{Binding AutocompleteQueryCommand}"
|
||||
|
|
@ -188,12 +187,16 @@
|
|||
Modifiers="Ctrl" />
|
||||
<KeyBinding
|
||||
Key="C"
|
||||
Modifiers="Ctrl+Shift"
|
||||
Command="{Binding CopyAlternativeCommand}" />
|
||||
Command="{Binding CopyAlternativeCommand}"
|
||||
Modifiers="Ctrl+Shift" />
|
||||
<KeyBinding
|
||||
Key="{Binding PreviewHotkey, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='key'}"
|
||||
Command="{Binding TogglePreviewCommand}"
|
||||
Modifiers="{Binding PreviewHotkey, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='modifiers'}" />
|
||||
<KeyBinding
|
||||
Key="{Binding AutoCompleteHotkey, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='key'}"
|
||||
Command="{Binding AutocompleteQueryCommand}"
|
||||
Modifiers="{Binding AutoCompleteHotkey, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='modifiers'}" />
|
||||
</Window.InputBindings>
|
||||
<Grid>
|
||||
<Border MouseDown="OnMouseDown" Style="{DynamicResource WindowBorderStyle}">
|
||||
|
|
|
|||
|
|
@ -2648,7 +2648,7 @@
|
|||
Margin="0,0,16,0"
|
||||
HorizontalAlignment="Right"
|
||||
HorizontalContentAlignment="Right"
|
||||
DataContext="{Binding ToggleHotkeyViewModel}"/>
|
||||
DataContext="{Binding ToggleHotkeyViewModel}" />
|
||||
|
||||
<TextBlock Style="{StaticResource Glyph}">
|
||||

|
||||
|
|
@ -2665,13 +2665,13 @@
|
|||
<TextBlock Style="{DynamicResource SettingSubTitleLabel}" Text="{DynamicResource previewHotkeyToolTip}" />
|
||||
</StackPanel>
|
||||
<flowlauncher:HotkeyControl
|
||||
DataContext="{Binding PreviewHotkeyViewModel}"
|
||||
x:Name="PreviewHotkeyControl"
|
||||
Grid.Row="0"
|
||||
Grid.Column="2"
|
||||
Margin="0,0,16,0"
|
||||
HorizontalAlignment="Right"
|
||||
HorizontalContentAlignment="Right" />
|
||||
HorizontalContentAlignment="Right"
|
||||
DataContext="{Binding PreviewHotkeyViewModel}" />
|
||||
<TextBlock Style="{StaticResource Glyph}">
|
||||

|
||||
</TextBlock>
|
||||
|
|
@ -2736,6 +2736,27 @@
|
|||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<StackPanel Grid.Row="2">
|
||||
<Border Margin="0,16,0,0" Style="{DynamicResource SettingGroupBox}">
|
||||
<ItemsControl Style="{StaticResource SettingGrid}">
|
||||
<StackPanel Style="{StaticResource TextPanel}">
|
||||
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="Auto Complete Hotkey" />
|
||||
<TextBlock Style="{DynamicResource SettingSubTitleLabel}" Text="Auto Complete Hotkey Subtitle" />
|
||||
</StackPanel>
|
||||
<flowlauncher:HotkeyControl
|
||||
Grid.Row="0"
|
||||
Grid.Column="2"
|
||||
Margin="0,0,16,0"
|
||||
HorizontalAlignment="Right"
|
||||
HorizontalContentAlignment="Right"
|
||||
DataContext="{Binding AutoCompleteHotkeyViewModel}" />
|
||||
<TextBlock Style="{StaticResource Glyph}">
|
||||

|
||||
</TextBlock>
|
||||
</ItemsControl>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="4"
|
||||
Margin="0,10,12,10"
|
||||
|
|
|
|||
|
|
@ -80,6 +80,9 @@ namespace Flow.Launcher.ViewModel
|
|||
case nameof(Settings.PreviewHotkey):
|
||||
OnPropertyChanged(nameof(PreviewHotkey));
|
||||
break;
|
||||
case nameof(Settings.AutoCompleteHotkey):
|
||||
OnPropertyChanged(nameof(AutoCompleteHotkey));
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -647,6 +650,27 @@ namespace Flow.Launcher.ViewModel
|
|||
}
|
||||
}
|
||||
|
||||
public string AutoCompleteHotkey
|
||||
{
|
||||
get
|
||||
{
|
||||
// TODO try to patch issue #1755
|
||||
// Added in v1.14.0, remove after v1.16.0.
|
||||
try
|
||||
{
|
||||
var converter = new KeyGestureConverter();
|
||||
var key = (KeyGesture)converter.ConvertFromString(Settings.AutoCompleteHotkey);
|
||||
}
|
||||
catch (Exception e) when (e is NotSupportedException || e is InvalidEnumArgumentException)
|
||||
{
|
||||
Settings.AutoCompleteHotkey = "F2";
|
||||
}
|
||||
|
||||
return Settings.AutoCompleteHotkey;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public string Image => Constant.QueryTextBoxIconImagePath;
|
||||
|
||||
public bool StartWithEnglishMode => Settings.AlwaysStartEn;
|
||||
|
|
|
|||
|
|
@ -82,6 +82,12 @@ namespace Flow.Launcher.ViewModel
|
|||
{
|
||||
Settings.PreviewHotkey = hotkey.ToString();
|
||||
});
|
||||
|
||||
AutoCompleteHotkeyViewModel =
|
||||
new HotkeyControlViewModel(Settings.AutoCompleteHotkey, "F2", false, hotkey =>
|
||||
{
|
||||
Settings.AutoCompleteHotkey = hotkey.ToString();
|
||||
});
|
||||
}
|
||||
|
||||
public Settings Settings { get; set; }
|
||||
|
|
@ -962,6 +968,7 @@ namespace Flow.Launcher.ViewModel
|
|||
|
||||
public HotkeyControlViewModel ToggleHotkeyViewModel { get; set; }
|
||||
public HotkeyControlViewModel PreviewHotkeyViewModel { get; set; }
|
||||
public HotkeyControlViewModel AutoCompleteHotkeyViewModel { get; set; }
|
||||
|
||||
private static DirectoryInfo GetLogDir(string version = "")
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue