Skip to content

Commit b243683

Browse files
Add option to modify preview hotkey
1 parent 3ff7566 commit b243683

File tree

3 files changed

+50
-10
lines changed

3 files changed

+50
-10
lines changed

Flow.Launcher/Languages/en.xaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
<system:String x:Key="ShouldUsePinyin">Search with Pinyin</system:String>
7171
<system:String x:Key="ShouldUsePinyinToolTip">Allows using Pinyin to search. Pinyin is the standard system of romanized spelling for translating Chinese.</system:String>
7272
<system:String x:Key="AlwaysPreview">Always Preview</system:String>
73-
<system:String x:Key="AlwaysPreviewToolTip">Always open preview panel when Flow starts. Press F1 to toggle preview.</system:String>
73+
<system:String x:Key="AlwaysPreviewToolTip">Always open preview panel when Flow starts. Press {0} to toggle preview.</system:String>
7474
<system:String x:Key="shadowEffectNotAllowed">Shadow effect is not allowed while current theme has blur effect enabled</system:String>
7575

7676
<!-- Setting Plugin -->
@@ -153,6 +153,8 @@
153153
<system:String x:Key="hotkey">Hotkey</system:String>
154154
<system:String x:Key="flowlauncherHotkey">Flow Launcher Hotkey</system:String>
155155
<system:String x:Key="flowlauncherHotkeyToolTip">Enter shortcut to show/hide Flow Launcher.</system:String>
156+
<system:String x:Key="previewHotkey">Preview Hotkey</system:String>
157+
<system:String x:Key="previewHotkeyToolTip">Enter shortcut to show/hide preview in search window.</system:String>
156158
<system:String x:Key="openResultModifiers">Open Result Modifier Key</system:String>
157159
<system:String x:Key="openResultModifiersToolTip">Select a modifier key to open selected result via keyboard.</system:String>
158160
<system:String x:Key="showOpenResultHotkey">Show Hotkey</system:String>

Flow.Launcher/SettingWindow.xaml

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2415,8 +2415,33 @@
24152415
</Border>
24162416
</StackPanel>
24172417

2418+
<StackPanel Grid.Row="2">
2419+
<Border Margin="0,8,0,0" Style="{DynamicResource SettingGroupBox}">
2420+
<ItemsControl Style="{StaticResource SettingGrid}">
2421+
<StackPanel Style="{StaticResource TextPanel}">
2422+
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource previewHotkey}"/>
2423+
<TextBlock Style="{DynamicResource SettingSubTitleLabel}" Text="{DynamicResource previewHotkeyToolTip}" />
2424+
</StackPanel>
2425+
<flowlauncher:HotkeyControl
2426+
x:Name="PreviewHotkeyControl"
2427+
Grid.Row="0"
2428+
Grid.Column="2"
2429+
Width="300"
2430+
Height="35"
2431+
Margin="0,0,0,0"
2432+
HorizontalAlignment="Right"
2433+
HorizontalContentAlignment="Right"
2434+
Loaded="OnPreviewHotkeyControlLoaded"
2435+
LostFocus="OnPreviewHotkeyControlFocusLost" />
2436+
<TextBlock Style="{StaticResource Glyph}">
2437+
&#xeda7;
2438+
</TextBlock>
2439+
</ItemsControl>
2440+
</Border>
2441+
</StackPanel>
2442+
24182443
<Border
2419-
Grid.Row="2"
2444+
Grid.Row="3"
24202445
Margin="0,12,0,0"
24212446
Padding="0"
24222447
CornerRadius="5"
@@ -2473,15 +2498,15 @@
24732498
</Border>
24742499

24752500
<TextBlock
2476-
Grid.Row="3"
2501+
Grid.Row="4"
24772502
Margin="0,10,12,10"
24782503
Padding="0,12,0,0"
24792504
VerticalAlignment="Center"
24802505
FontSize="14"
24812506
Foreground="{DynamicResource Color05B}"
24822507
Text="{DynamicResource customQueryHotkey}" />
24832508
<ListView
2484-
Grid.Row="4"
2509+
Grid.Row="5"
24852510
MinHeight="160"
24862511
Margin="0,0,0,0"
24872512
Background="{DynamicResource Color02B}"
@@ -2510,7 +2535,7 @@
25102535
</ListView.View>
25112536
</ListView>
25122537
<StackPanel
2513-
Grid.Row="5"
2538+
Grid.Row="6"
25142539
Margin="0"
25152540
HorizontalAlignment="Right"
25162541
VerticalAlignment="Top"
@@ -2533,7 +2558,7 @@
25332558
</StackPanel>
25342559

25352560
<TextBlock
2536-
Grid.Row="6"
2561+
Grid.Row="7"
25372562
Margin="0,0,12,2"
25382563
Padding="0,12,0,0"
25392564
VerticalAlignment="Center"
@@ -2542,7 +2567,7 @@
25422567
Text="{DynamicResource customQueryShortcut}" />
25432568
<ListView
25442569
Name="customShortcutView"
2545-
Grid.Row="7"
2570+
Grid.Row="8"
25462571
MinHeight="160"
25472572
Margin="0,6,0,0"
25482573
Background="{DynamicResource Color02B}"
@@ -2571,7 +2596,7 @@
25712596
</ListView.View>
25722597
</ListView>
25732598
<StackPanel
2574-
Grid.Row="8"
2599+
Grid.Row="9"
25752600
Margin="0"
25762601
HorizontalAlignment="Right"
25772602
VerticalAlignment="Top"
@@ -2594,15 +2619,15 @@
25942619
</StackPanel>
25952620

25962621
<TextBlock
2597-
Grid.Row="9"
2622+
Grid.Row="10"
25982623
Margin="0,0,12,2"
25992624
Padding="0,12,0,0"
26002625
VerticalAlignment="Center"
26012626
FontSize="14"
26022627
Foreground="{DynamicResource Color05B}"
26032628
Text="{DynamicResource builtinShortcuts}" />
26042629
<ListView
2605-
Grid.Row="10"
2630+
Grid.Row="11"
26062631
MinHeight="160"
26072632
Margin="0,6,0,20"
26082633
Background="{DynamicResource Color02B}"

Flow.Launcher/SettingWindow.xaml.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,19 @@ private void OnHotkeyControlFocusLost(object sender, RoutedEventArgs e)
131131
}
132132
}
133133

134+
private void OnPreviewHotkeyControlLoaded(object sender, RoutedEventArgs e)
135+
{
136+
_ = PreviewHotkeyControl.SetHotkeyAsync(settings.PreviewHotkey, false);
137+
}
138+
139+
private void OnPreviewHotkeyControlFocusLost(object sender, RoutedEventArgs e)
140+
{
141+
if (PreviewHotkeyControl.CurrentHotkeyAvailable)
142+
{
143+
settings.PreviewHotkey = PreviewHotkeyControl.CurrentHotkey.ToString();
144+
}
145+
}
146+
134147
private void OnDeleteCustomHotkeyClick(object sender, RoutedEventArgs e)
135148
{
136149
var item = viewModel.SelectedCustomPluginHotkey;

0 commit comments

Comments
 (0)