Add Next/Prev Hotkey Item

This commit is contained in:
DB p 2024-04-15 21:52:15 +09:00
parent c39da2f5f3
commit e53e1a0222
6 changed files with 77 additions and 14 deletions

View file

@ -20,7 +20,9 @@ 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 AutoCompleteHotkey { get; set; } = $"{KeyConstant.Ctrl} + P";
public string SelectNextItemHotkey { get; set; } = $"Tab";
public string SelectPrevItemHotkey { get; set; } = $"Shift + Tab";
public string Language
{

View file

@ -180,6 +180,10 @@
<system:String x:Key="openResultModifiersToolTip">Select a modifier key to open selected result via keyboard.</system:String>
<system:String x:Key="showOpenResultHotkey">Show Hotkey</system:String>
<system:String x:Key="showOpenResultHotkeyToolTip">Show result selection hotkey with results.</system:String>
<system:String x:Key="autoCompleteHotkey">Auto Complete Hotkey</system:String>
<system:String x:Key="autoCompleteHotkeyToolTip">Runs autocomplete for the selected items.</system:String>
<system:String x:Key="SelectNextItemHotkey">Next Item Hotkey</system:String>
<system:String x:Key="SelectPrevItemHotkey">Prev Item Hotkey</system:String>
<system:String x:Key="customQueryHotkey">Custom Query Hotkeys</system:String>
<system:String x:Key="customQueryShortcut">Custom Query Shortcuts</system:String>
<system:String x:Key="builtinShortcuts">Built-in Shortcuts</system:String>

View file

@ -46,18 +46,10 @@
<Window.InputBindings>
<KeyBinding Key="Escape" Command="{Binding EscCommand}" />
<KeyBinding Key="F5" Command="{Binding ReloadPluginDataCommand}" />
<KeyBinding
Key="Tab"
Command="{Binding AutocompleteQueryCommand}"
Modifiers="Shift" />
<KeyBinding
Key="I"
Command="{Binding OpenSettingCommand}"
Modifiers="Ctrl" />
<KeyBinding
Key="N"
Command="{Binding SelectNextItemCommand}"
Modifiers="Ctrl" />
<KeyBinding
Key="J"
Command="{Binding SelectNextItemCommand}"
@ -197,6 +189,14 @@
Key="{Binding AutoCompleteHotkey, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='key'}"
Command="{Binding AutocompleteQueryCommand}"
Modifiers="{Binding AutoCompleteHotkey, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='modifiers'}" />
<KeyBinding
Key="{Binding SelectNextItemHotkey, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='key'}"
Command="{Binding SelectNextItemCommand}"
Modifiers="{Binding SelectNextItemHotkey, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='modifiers'}" />
<KeyBinding
Key="{Binding SelectPrevItemHotkey, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='key'}"
Command="{Binding SelectPrevItemCommand}"
Modifiers="{Binding SelectPrevItemHotkey, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='modifiers'}" />
</Window.InputBindings>
<Grid>
<Border MouseDown="OnMouseDown" Style="{DynamicResource WindowBorderStyle}">

View file

@ -2740,8 +2740,8 @@
<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" />
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource autoCompleteHotkey}" />
<TextBlock Style="{DynamicResource SettingSubTitleLabel}" Text="{DynamicResource autoCompleteHotkeyToolTip}" />
</StackPanel>
<flowlauncher:HotkeyControl
Grid.Row="0"
@ -2751,7 +2751,43 @@
HorizontalContentAlignment="Right"
DataContext="{Binding AutoCompleteHotkeyViewModel}" />
<TextBlock Style="{StaticResource Glyph}">
&#xe765;
&#xe893;
</TextBlock>
</ItemsControl>
</Border>
<Border Margin="0,8,0,0" Style="{DynamicResource SettingGroupBox}">
<ItemsControl Style="{StaticResource SettingGrid}">
<StackPanel Style="{StaticResource TextPanel}">
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource SelectNextItemHotkey}" />
</StackPanel>
<flowlauncher:HotkeyControl
x:Name="SelectNextItemHotkeyControl"
Grid.Row="0"
Grid.Column="2"
Margin="0,0,16,0"
HorizontalAlignment="Right"
HorizontalContentAlignment="Right"
DataContext="{Binding SelectNextItemHotkeyViewModel}" />
<TextBlock Style="{StaticResource Glyph}">
&#xf0ae;
</TextBlock>
</ItemsControl>
</Border>
<Border Margin="0,8,0,0" Style="{DynamicResource SettingGroupBox}">
<ItemsControl Style="{StaticResource SettingGrid}">
<StackPanel Style="{StaticResource TextPanel}">
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource SelectPrevItemHotkey}" />
</StackPanel>
<flowlauncher:HotkeyControl
x:Name="SelectPrevItemHotkeyControl"
Grid.Row="0"
Grid.Column="2"
Margin="0,0,16,0"
HorizontalAlignment="Right"
HorizontalContentAlignment="Right"
DataContext="{Binding SelectPrevItemHotkeyViewModel}" />
<TextBlock Style="{StaticResource Glyph}">
&#xf0ad;
</TextBlock>
</ItemsControl>
</Border>

View file

@ -83,6 +83,12 @@ namespace Flow.Launcher.ViewModel
case nameof(Settings.AutoCompleteHotkey):
OnPropertyChanged(nameof(AutoCompleteHotkey));
break;
case nameof(Settings.SelectNextItemHotkey):
OnPropertyChanged(nameof(SelectNextItemHotkey));
break;
case nameof(Settings.SelectPrevItemHotkey):
OnPropertyChanged(nameof(SelectPrevItemHotkey));
break;
}
};
@ -647,7 +653,9 @@ namespace Flow.Launcher.ViewModel
public string PreviewHotkey => VerifyOrSetDefaultHotkey(Settings.PreviewHotkey, "F1");
public string AutoCompleteHotkey => VerifyOrSetDefaultHotkey(Settings.AutoCompleteHotkey, "Tab");
public string AutoCompleteHotkey => VerifyOrSetDefaultHotkey(Settings.AutoCompleteHotkey, "");
public string SelectNextItemHotkey => VerifyOrSetDefaultHotkey(Settings.SelectNextItemHotkey, "Tab");
public string SelectPrevItemHotkey => VerifyOrSetDefaultHotkey(Settings.SelectPrevItemHotkey, "Shift + Tab");
public string Image => Constant.QueryTextBoxIconImagePath;

View file

@ -84,10 +84,21 @@ namespace Flow.Launcher.ViewModel
});
AutoCompleteHotkeyViewModel =
new HotkeyControlViewModel(Settings.AutoCompleteHotkey, "F2", false, hotkey =>
new HotkeyControlViewModel(Settings.AutoCompleteHotkey, "Ctrl+P", false, hotkey =>
{
Settings.AutoCompleteHotkey = hotkey.ToString();
});
SelectNextItemHotkeyViewModel =
new HotkeyControlViewModel(Settings.SelectNextItemHotkey, "Tab", false, hotkey =>
{
Settings.SelectNextItemHotkey = hotkey.ToString();
});
SelectPrevItemHotkeyViewModel =
new HotkeyControlViewModel(Settings.SelectPrevItemHotkey, "Shift+Tab", false, hotkey =>
{
Settings.SelectPrevItemHotkey = hotkey.ToString();
});
}
public Settings Settings { get; set; }
@ -969,6 +980,8 @@ namespace Flow.Launcher.ViewModel
public HotkeyControlViewModel ToggleHotkeyViewModel { get; set; }
public HotkeyControlViewModel PreviewHotkeyViewModel { get; set; }
public HotkeyControlViewModel AutoCompleteHotkeyViewModel { get; set; }
public HotkeyControlViewModel SelectNextItemHotkeyViewModel { get; set; }
public HotkeyControlViewModel SelectPrevItemHotkeyViewModel { get; set; }
private static DirectoryInfo GetLogDir(string version = "")
{