diff --git a/Flow.Launcher/HotkeyControl.xaml b/Flow.Launcher/HotkeyControl.xaml index 488b80202..c4a3d8986 100644 --- a/Flow.Launcher/HotkeyControl.xaml +++ b/Flow.Launcher/HotkeyControl.xaml @@ -100,6 +100,7 @@ IsChecked="{Binding Recording}" KeyboardNavigation.TabNavigation="Continue" PreviewKeyDown="OnPreviewKeyDown" + LostFocus="HotkeyBtn_OnLostFocus" Style="{StaticResource {x:Type ToggleButton}}"> diff --git a/Flow.Launcher/HotkeyControl.xaml.cs b/Flow.Launcher/HotkeyControl.xaml.cs index 071f844f4..c9fdaa007 100644 --- a/Flow.Launcher/HotkeyControl.xaml.cs +++ b/Flow.Launcher/HotkeyControl.xaml.cs @@ -93,5 +93,10 @@ namespace Flow.Launcher { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } + + private void HotkeyBtn_OnLostFocus(object sender, RoutedEventArgs e) + { + _ = ((HotkeyControlViewModel)DataContext).RegisterHotkey(); + } } } diff --git a/Flow.Launcher/ViewModel/HotkeyControlViewModel.cs b/Flow.Launcher/ViewModel/HotkeyControlViewModel.cs index 7d90e50b1..afc7d6a39 100644 --- a/Flow.Launcher/ViewModel/HotkeyControlViewModel.cs +++ b/Flow.Launcher/ViewModel/HotkeyControlViewModel.cs @@ -222,6 +222,11 @@ namespace Flow.Launcher.ViewModel container.Add(EmptyHotkey); } } + + public Task RegisterHotkey() + { + return SetHotkeyAsync(Hotkey, true); + } public Task SetHotkeyAsync(string? keyStr, bool triggerValidate = true) {