Skip to content

Commit 28ff6ac

Browse files
Allow HOTKEY+0 to open the 10th result
1 parent 1546f63 commit 28ff6ac

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

Flow.Launcher/Converters/OpenResultHotkeyVisibilityConverter.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ namespace Flow.Launcher.Converters
1111
[ValueConversion(typeof(bool), typeof(Visibility))]
1212
public class OpenResultHotkeyVisibilityConverter : IValueConverter
1313
{
14-
private const int MaxVisibleHotkeys = 9;
14+
private const int MaxVisibleHotkeys = 10;
1515

1616
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
1717
{
18-
var hotkeyNumber = int.MaxValue;
18+
var number = int.MaxValue;
1919

2020
if (value is ListBoxItem listBoxItem
2121
&& ItemsControl.ItemsControlFromItemContainer(listBoxItem) is ListBox listBox)
22-
hotkeyNumber = listBox.ItemContainerGenerator.IndexFromContainer(listBoxItem) + 1;
22+
number = listBox.ItemContainerGenerator.IndexFromContainer(listBoxItem) + 1;
2323

24-
return hotkeyNumber <= MaxVisibleHotkeys ? Visibility.Visible : Visibility.Collapsed;
24+
return number <= MaxVisibleHotkeys ? Visibility.Visible : Visibility.Collapsed;
2525
}
2626

2727
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new System.InvalidOperationException();

Flow.Launcher/Converters/OrdinalConverter.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ public object Convert(object value, System.Type targetType, object parameter, Cu
1010
{
1111
if (value is ListBoxItem listBoxItem
1212
&& ItemsControl.ItemsControlFromItemContainer(listBoxItem) is ListBox listBox)
13-
return listBox.ItemContainerGenerator.IndexFromContainer(listBoxItem) + 1;
13+
{
14+
var res = listBox.ItemContainerGenerator.IndexFromContainer(listBoxItem) + 1;
15+
return res == 10 ? 0 : res; // 10th item => HOTKEY+0
16+
}
1417

1518
return 0;
1619
}

Flow.Launcher/MainWindow.xaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,11 @@
150150
Command="{Binding OpenResultCommand}"
151151
CommandParameter="8"
152152
Modifiers="{Binding OpenResultCommandModifiers}" />
153+
<KeyBinding
154+
Key="D0"
155+
Command="{Binding OpenResultCommand}"
156+
CommandParameter="9"
157+
Modifiers="{Binding OpenResultCommandModifiers}" />
153158
</Window.InputBindings>
154159
<Grid>
155160
<Border MouseDown="OnMouseDown" Style="{DynamicResource WindowBorderStyle}">

0 commit comments

Comments
 (0)