Skip to content

Commit 05486ea

Browse files
committed
Add OpenHistory hotkey functionality and binding
1 parent 6144d4a commit 05486ea

File tree

5 files changed

+20
-6
lines changed

5 files changed

+20
-6
lines changed

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public void Save()
5050
public string SelectPrevPageHotkey { get; set; } = $"PageDown";
5151
public string OpenContextMenuHotkey { get; set; } = $"Ctrl+O";
5252
public string SettingWindowHotkey { get; set; } = $"Ctrl+I";
53+
public string OpenHistoryHotkey { get; set; } = $"Ctrl+H";
5354
public string CycleHistoryUpHotkey { get; set; } = $"{KeyConstant.Alt} + Up";
5455
public string CycleHistoryDownHotkey { get; set; } = $"{KeyConstant.Alt} + Down";
5556

@@ -426,6 +427,8 @@ public List<RegisteredHotkeyData> RegisteredHotkeys
426427
list.Add(new(SelectPrevItemHotkey2, "SelectPrevItemHotkey", () => SelectPrevItemHotkey2 = ""));
427428
if (!string.IsNullOrEmpty(SettingWindowHotkey))
428429
list.Add(new(SettingWindowHotkey, "SettingWindowHotkey", () => SettingWindowHotkey = ""));
430+
if (!string.IsNullOrEmpty(OpenHistoryHotkey))
431+
list.Add(new(OpenHistoryHotkey, "OpenHistoryHotkey", () => OpenHistoryHotkey = ""));
429432
if (!string.IsNullOrEmpty(OpenContextMenuHotkey))
430433
list.Add(new(OpenContextMenuHotkey, "OpenContextMenuHotkey", () => OpenContextMenuHotkey = ""));
431434
if (!string.IsNullOrEmpty(SelectNextPageHotkey))
@@ -461,7 +464,6 @@ private List<RegisteredHotkeyData> FixedHotkeys()
461464
new("Alt+Home", "HotkeySelectFirstResult"),
462465
new("Alt+End", "HotkeySelectLastResult"),
463466
new("Ctrl+R", "HotkeyRequery"),
464-
new("Ctrl+H", "ToggleHistoryHotkey"),
465467
new("Ctrl+OemCloseBrackets", "QuickWidthHotkey"),
466468
new("Ctrl+OemOpenBrackets", "QuickWidthHotkey"),
467469
new("Ctrl+OemPlus", "QuickHeightHotkey"),

Flow.Launcher/HotkeyControl.xaml.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ public enum HotkeyType
100100
PreviewHotkey,
101101
OpenContextMenuHotkey,
102102
SettingWindowHotkey,
103+
OpenHistoryHotkey,
103104
CycleHistoryUpHotkey,
104105
CycleHistoryDownHotkey,
105106
SelectPrevPageHotkey,
@@ -130,6 +131,7 @@ public string Hotkey
130131
HotkeyType.PreviewHotkey => _settings.PreviewHotkey,
131132
HotkeyType.OpenContextMenuHotkey => _settings.OpenContextMenuHotkey,
132133
HotkeyType.SettingWindowHotkey => _settings.SettingWindowHotkey,
134+
HotkeyType.OpenHistoryHotkey => _settings.OpenHistoryHotkey,
133135
HotkeyType.CycleHistoryUpHotkey => _settings.CycleHistoryUpHotkey,
134136
HotkeyType.CycleHistoryDownHotkey => _settings.CycleHistoryDownHotkey,
135137
HotkeyType.SelectPrevPageHotkey => _settings.SelectPrevPageHotkey,
@@ -166,6 +168,9 @@ public string Hotkey
166168
case HotkeyType.SettingWindowHotkey:
167169
_settings.SettingWindowHotkey = value;
168170
break;
171+
case HotkeyType.OpenHistoryHotkey:
172+
_settings.OpenHistoryHotkey = value;
173+
break;
169174
case HotkeyType.CycleHistoryUpHotkey:
170175
_settings.CycleHistoryUpHotkey = value;
171176
break;

Flow.Launcher/MainWindow.xaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,6 @@
6464
Key="R"
6565
Command="{Binding ReQueryCommand}"
6666
Modifiers="Ctrl" />
67-
<KeyBinding
68-
Key="H"
69-
Command="{Binding LoadHistoryCommand}"
70-
Modifiers="Ctrl" />
7167
<KeyBinding
7268
Key="OemCloseBrackets"
7369
Command="{Binding IncreaseWidthCommand}"
@@ -191,6 +187,10 @@
191187
Key="{Binding SettingWindowHotkey, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='key'}"
192188
Command="{Binding OpenSettingCommand}"
193189
Modifiers="{Binding SettingWindowHotkey, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='modifiers'}" />
190+
<KeyBinding
191+
Key="{Binding OpenHistoryHotkey, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='key'}"
192+
Command="{Binding LoadHistoryCommand}"
193+
Modifiers="{Binding OpenHistoryHotkey, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='modifiers'}" />
194194
<KeyBinding
195195
Key="{Binding OpenContextMenuHotkey, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='key'}"
196196
Command="{Binding LoadContextMenuCommand}"

Flow.Launcher/SettingPages/Views/SettingsPaneHotkey.xaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,10 @@
8989
Title="{DynamicResource ToggleHistoryHotkey}"
9090
Icon="&#xf738;"
9191
Type="Inside">
92-
<cc:HotkeyDisplay Keys="Ctrl+H" />
92+
<flowlauncher:HotkeyControl
93+
DefaultHotkey="Ctrl+H"
94+
Type="OpenHistoryHotkey"
95+
ValidateKeyGesture="False" />
9396
</cc:Card>
9497
<cc:Card
9598
Title="{DynamicResource CopyFilePathHotkey}"

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ public MainViewModel()
137137
case nameof(Settings.SettingWindowHotkey):
138138
OnPropertyChanged(nameof(SettingWindowHotkey));
139139
break;
140+
case nameof(Settings.OpenHistoryHotkey):
141+
OnPropertyChanged(nameof(OpenHistoryHotkey));
142+
break;
140143
}
141144
};
142145

@@ -886,6 +889,7 @@ private static string VerifyOrSetDefaultHotkey(string hotkey, string defaultHotk
886889
public string SelectPrevPageHotkey => VerifyOrSetDefaultHotkey(Settings.SelectPrevPageHotkey, "");
887890
public string OpenContextMenuHotkey => VerifyOrSetDefaultHotkey(Settings.OpenContextMenuHotkey, "Ctrl+O");
888891
public string SettingWindowHotkey => VerifyOrSetDefaultHotkey(Settings.SettingWindowHotkey, "Ctrl+I");
892+
public string OpenHistoryHotkey => VerifyOrSetDefaultHotkey(Settings.OpenHistoryHotkey, "Ctrl+H");
889893
public string CycleHistoryUpHotkey => VerifyOrSetDefaultHotkey(Settings.CycleHistoryUpHotkey, "Alt+Up");
890894
public string CycleHistoryDownHotkey => VerifyOrSetDefaultHotkey(Settings.CycleHistoryDownHotkey, "Alt+Down");
891895

0 commit comments

Comments
 (0)