From 1defb6a4172e9fd6dd0d8b0cb6b4fc3896eaa312 Mon Sep 17 00:00:00 2001 From: Vic <10308169+VictoriousRaptor@users.noreply.github.com> Date: Mon, 9 Jan 2023 18:02:50 +0800 Subject: [PATCH 01/14] Refactor HotkeyModel --- .../Hotkey/HotkeyModel.cs | 62 +++++++++++++++---- 1 file changed, 49 insertions(+), 13 deletions(-) diff --git a/Flow.Launcher.Infrastructure/Hotkey/HotkeyModel.cs b/Flow.Launcher.Infrastructure/Hotkey/HotkeyModel.cs index 5bd97714c15..e4a020cb706 100644 --- a/Flow.Launcher.Infrastructure/Hotkey/HotkeyModel.cs +++ b/Flow.Launcher.Infrastructure/Hotkey/HotkeyModel.cs @@ -11,10 +11,21 @@ public class HotkeyModel public bool Shift { get; set; } public bool Win { get; set; } public bool Ctrl { get; set; } - public Key CharKey { get; set; } + private Key charKey = Key.None; + public Key CharKey + { + get => charKey; + set + { + if (ValidateHotkey(value)) + { + charKey = value; + } + } + } - Dictionary specialSymbolDictionary = new Dictionary + private static readonly Dictionary specialSymbolDictionary = new Dictionary { {Key.Space, "Space"}, {Key.Oem3, "~"} @@ -86,7 +97,7 @@ private void Parse(string hotkeyString) Ctrl = true; keys.Remove("Ctrl"); } - if (keys.Count > 0) + if (keys.Count == 1) { string charKey = keys[0]; KeyValuePair? specialSymbolPair = specialSymbolDictionary.FirstOrDefault(pair => pair.Value == charKey); @@ -110,36 +121,61 @@ private void Parse(string hotkeyString) public override string ToString() { - string text = string.Empty; + List keys = new List(); if (Ctrl) { - text += "Ctrl + "; + keys.Add("Ctrl"); } if (Alt) { - text += "Alt + "; + keys.Add("Alt"); } if (Shift) { - text += "Shift + "; + keys.Add("Shift"); } if (Win) { - text += "Win + "; + keys.Add("Win"); } if (CharKey != Key.None) { - text += specialSymbolDictionary.ContainsKey(CharKey) + keys.Add(specialSymbolDictionary.ContainsKey(CharKey) ? specialSymbolDictionary[CharKey] - : CharKey.ToString(); + : CharKey.ToString()); + } + return string.Join(" + ", keys); + } + + private static bool ValidateHotkey(Key key) + { + HashSet invalidKeys = new() + { + Key.LeftAlt, Key.RightAlt, + Key.LeftCtrl, Key.RightCtrl, + Key.LeftShift, Key.RightShift, + Key.LWin, Key.RWin, + }; + + return !invalidKeys.Contains(key); + } + + public override bool Equals(object obj) + { + if (obj is HotkeyModel other) + { + return ModifierKeys == other.ModifierKeys && CharKey == other.charKey; } - else if (!string.IsNullOrEmpty(text)) + else { - text = text.Remove(text.Length - 3); + return false; } + } - return text; + public override int GetHashCode() + { + return this.ToString().GetHashCode(); } } } From 10fa2f7beb8d01a35990ba6c156db2c263e11acd Mon Sep 17 00:00:00 2001 From: Vic <10308169+VictoriousRaptor@users.noreply.github.com> Date: Mon, 9 Jan 2023 21:50:29 +0800 Subject: [PATCH 02/14] Validate hotkey --- Flow.Launcher/HotkeyControl.xaml.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Flow.Launcher/HotkeyControl.xaml.cs b/Flow.Launcher/HotkeyControl.xaml.cs index d746c8fd25d..ffa73da155d 100644 --- a/Flow.Launcher/HotkeyControl.xaml.cs +++ b/Flow.Launcher/HotkeyControl.xaml.cs @@ -9,7 +9,6 @@ using Flow.Launcher.Infrastructure.Hotkey; using Flow.Launcher.Plugin; using System.Threading; -using System.Windows.Interop; namespace Flow.Launcher { @@ -79,7 +78,7 @@ public async Task SetHotkeyAsync(HotkeyModel keyModel, bool triggerValidate = tr if (triggerValidate) { - CurrentHotkeyAvailable = CheckHotkeyAvailability(); + CurrentHotkeyAvailable = CurrentHotkey.CharKey != Key.None && CheckHotkeyAvailability(); if (!CurrentHotkeyAvailable) { tbMsg.Foreground = new SolidColorBrush(Colors.Red); From ff79651fb2bd1b7ddde8345d05da92938434e9aa Mon Sep 17 00:00:00 2001 From: Vic <10308169+VictoriousRaptor@users.noreply.github.com> Date: Mon, 9 Jan 2023 22:08:27 +0800 Subject: [PATCH 03/14] Use Equals() for comparison --- Flow.Launcher/HotkeyControl.xaml.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Flow.Launcher/HotkeyControl.xaml.cs b/Flow.Launcher/HotkeyControl.xaml.cs index ffa73da155d..7d2da76da70 100644 --- a/Flow.Launcher/HotkeyControl.xaml.cs +++ b/Flow.Launcher/HotkeyControl.xaml.cs @@ -54,9 +54,7 @@ private void TbHotkey_OnPreviewKeyDown(object sender, KeyEventArgs e) specialKeyState.CtrlPressed, key); - var hotkeyString = hotkeyModel.ToString(); - - if (hotkeyString == tbHotkey.Text) + if (hotkeyModel.Equals(CurrentHotkey)) { return; } From cd056f6355d945dd367807f594c7e59b1041a14d Mon Sep 17 00:00:00 2001 From: Vic <10308169+VictoriousRaptor@users.noreply.github.com> Date: Mon, 9 Jan 2023 22:09:39 +0800 Subject: [PATCH 04/14] Use overloaded version --- Flow.Launcher/Resources/Pages/WelcomePage2.xaml.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Flow.Launcher/Resources/Pages/WelcomePage2.xaml.cs b/Flow.Launcher/Resources/Pages/WelcomePage2.xaml.cs index 4f8d653781c..e89a7dd03cb 100644 --- a/Flow.Launcher/Resources/Pages/WelcomePage2.xaml.cs +++ b/Flow.Launcher/Resources/Pages/WelcomePage2.xaml.cs @@ -27,7 +27,7 @@ protected override void OnNavigatedTo(NavigationEventArgs e) tbMsgTextOriginal = HotkeyControl.tbMsg.Text; tbMsgForegroundColorOriginal = HotkeyControl.tbMsg.Foreground; - HotkeyControl.SetHotkeyAsync(new Infrastructure.Hotkey.HotkeyModel(Settings.Hotkey), false); + HotkeyControl.SetHotkeyAsync(Settings.Hotkey, false); } private void HotkeyControl_OnGotFocus(object sender, RoutedEventArgs args) { @@ -49,4 +49,4 @@ private void HotkeyControl_OnLostFocus(object sender, RoutedEventArgs args) HotkeyControl.tbMsg.Foreground = tbMsgForegroundColorOriginal; } } -} \ No newline at end of file +} From 0c58c2b4f93569a56bd5a6cfa493af749958a3dd Mon Sep 17 00:00:00 2001 From: Vic <10308169+VictoriousRaptor@users.noreply.github.com> Date: Tue, 10 Jan 2023 15:01:30 +0800 Subject: [PATCH 05/14] Ban single character key --- Flow.Launcher.Infrastructure/Hotkey/HotkeyModel.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Flow.Launcher.Infrastructure/Hotkey/HotkeyModel.cs b/Flow.Launcher.Infrastructure/Hotkey/HotkeyModel.cs index e4a020cb706..54115f129cf 100644 --- a/Flow.Launcher.Infrastructure/Hotkey/HotkeyModel.cs +++ b/Flow.Launcher.Infrastructure/Hotkey/HotkeyModel.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Windows.Input; +using System.Windows.Navigation; namespace Flow.Launcher.Infrastructure.Hotkey { @@ -148,7 +149,7 @@ public override string ToString() return string.Join(" + ", keys); } - private static bool ValidateHotkey(Key key) + private bool ValidateHotkey(Key key) { HashSet invalidKeys = new() { @@ -158,7 +159,15 @@ private static bool ValidateHotkey(Key key) Key.LWin, Key.RWin, }; - return !invalidKeys.Contains(key); + if (invalidKeys.Contains(key)) + { + return false; + } + if (ModifierKeys == ModifierKeys.None) + { + return key >= Key.F1 && key <= Key.F24; + } + return true; } public override bool Equals(object obj) From f6e2fe3525a28a38119cc7369c80b6a23b01eba1 Mon Sep 17 00:00:00 2001 From: Vic <10308169+VictoriousRaptor@users.noreply.github.com> Date: Wed, 11 Jan 2023 12:14:18 +0800 Subject: [PATCH 06/14] Reset message when got focus --- Flow.Launcher/HotkeyControl.xaml | 1 + Flow.Launcher/HotkeyControl.xaml.cs | 18 +++++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Flow.Launcher/HotkeyControl.xaml b/Flow.Launcher/HotkeyControl.xaml index 5a593d20a19..acf4a21ec40 100644 --- a/Flow.Launcher/HotkeyControl.xaml +++ b/Flow.Launcher/HotkeyControl.xaml @@ -48,6 +48,7 @@ Margin="0,0,18,0" VerticalContentAlignment="Center" input:InputMethod.IsInputMethodEnabled="False" + GotFocus="tbHotkey_GotFocus" LostFocus="tbHotkey_LostFocus" PreviewKeyDown="TbHotkey_OnPreviewKeyDown" TabIndex="100" /> diff --git a/Flow.Launcher/HotkeyControl.xaml.cs b/Flow.Launcher/HotkeyControl.xaml.cs index 7d2da76da70..b1340cddc2f 100644 --- a/Flow.Launcher/HotkeyControl.xaml.cs +++ b/Flow.Launcher/HotkeyControl.xaml.cs @@ -14,10 +14,6 @@ namespace Flow.Launcher { public partial class HotkeyControl : UserControl { - private Brush tbMsgForegroundColorOriginal; - - private string tbMsgTextOriginal; - public HotkeyModel CurrentHotkey { get; private set; } public bool CurrentHotkeyAvailable { get; private set; } @@ -28,8 +24,6 @@ public partial class HotkeyControl : UserControl public HotkeyControl() { InitializeComponent(); - tbMsgTextOriginal = tbMsg.Text; - tbMsgForegroundColorOriginal = tbMsg.Foreground; } private CancellationTokenSource hotkeyUpdateSource; @@ -110,7 +104,17 @@ public Task SetHotkeyAsync(string keyStr, bool triggerValidate = true) private void tbHotkey_LostFocus(object sender, RoutedEventArgs e) { - tbMsg.Text = tbMsgTextOriginal; + + } + + private void tbHotkey_GotFocus(object sender, RoutedEventArgs e) + { + ResetMessage(); + } + + private void ResetMessage() + { + tbMsg.Text = InternationalizationManager.Instance.GetTranslation("flowlauncherPressHotkey"); tbMsg.SetResourceReference(TextBox.ForegroundProperty, "Color05B"); } } From a399d24c1e06c67703c57932c2a37b76c24bebaf Mon Sep 17 00:00:00 2001 From: Vic <10308169+VictoriousRaptor@users.noreply.github.com> Date: Wed, 11 Jan 2023 14:03:44 +0800 Subject: [PATCH 07/14] Extract set message logic --- Flow.Launcher/HotkeyControl.xaml.cs | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/Flow.Launcher/HotkeyControl.xaml.cs b/Flow.Launcher/HotkeyControl.xaml.cs index b1340cddc2f..7fac47e4d9e 100644 --- a/Flow.Launcher/HotkeyControl.xaml.cs +++ b/Flow.Launcher/HotkeyControl.xaml.cs @@ -70,18 +70,8 @@ public async Task SetHotkeyAsync(HotkeyModel keyModel, bool triggerValidate = tr if (triggerValidate) { - CurrentHotkeyAvailable = CurrentHotkey.CharKey != Key.None && CheckHotkeyAvailability(); - if (!CurrentHotkeyAvailable) - { - tbMsg.Foreground = new SolidColorBrush(Colors.Red); - tbMsg.Text = InternationalizationManager.Instance.GetTranslation("hotkeyUnavailable"); - } - else - { - tbMsg.Foreground = new SolidColorBrush(Colors.Green); - tbMsg.Text = InternationalizationManager.Instance.GetTranslation("success"); - } - tbMsg.Visibility = Visibility.Visible; + bool hotkeyAvailable = keyModel.CharKey != Key.None && CheckHotkeyAvailability(keyModel); + SetMessage(hotkeyAvailable); OnHotkeyChanged(); var token = hotkeyUpdateSource.Token; @@ -117,5 +107,20 @@ private void ResetMessage() tbMsg.Text = InternationalizationManager.Instance.GetTranslation("flowlauncherPressHotkey"); tbMsg.SetResourceReference(TextBox.ForegroundProperty, "Color05B"); } + + private void SetMessage(bool hotkeyAvailable) + { + if (!hotkeyAvailable) + { + tbMsg.Foreground = new SolidColorBrush(Colors.Red); + tbMsg.Text = InternationalizationManager.Instance.GetTranslation("hotkeyUnavailable"); + } + else + { + tbMsg.Foreground = new SolidColorBrush(Colors.Green); + tbMsg.Text = InternationalizationManager.Instance.GetTranslation("success"); + } + tbMsg.Visibility = Visibility.Visible; + } } } From 72f8b9e052ddf14d615fd1287e0d0c2685fadc5e Mon Sep 17 00:00:00 2001 From: Vic <10308169+VictoriousRaptor@users.noreply.github.com> Date: Wed, 11 Jan 2023 16:11:34 +0800 Subject: [PATCH 08/14] Refactor HotkeyModel validation logic --- .../Hotkey/HotkeyModel.cs | 53 ++++++++----------- 1 file changed, 23 insertions(+), 30 deletions(-) diff --git a/Flow.Launcher.Infrastructure/Hotkey/HotkeyModel.cs b/Flow.Launcher.Infrastructure/Hotkey/HotkeyModel.cs index 54115f129cf..0908a404b82 100644 --- a/Flow.Launcher.Infrastructure/Hotkey/HotkeyModel.cs +++ b/Flow.Launcher.Infrastructure/Hotkey/HotkeyModel.cs @@ -13,18 +13,7 @@ public class HotkeyModel public bool Win { get; set; } public bool Ctrl { get; set; } - private Key charKey = Key.None; - public Key CharKey - { - get => charKey; - set - { - if (ValidateHotkey(value)) - { - charKey = value; - } - } - } + public Key CharKey { get; set; } = Key.None; private static readonly Dictionary specialSymbolDictionary = new Dictionary { @@ -149,32 +138,36 @@ public override string ToString() return string.Join(" + ", keys); } - private bool ValidateHotkey(Key key) + public bool Validate() { - HashSet invalidKeys = new() - { - Key.LeftAlt, Key.RightAlt, - Key.LeftCtrl, Key.RightCtrl, - Key.LeftShift, Key.RightShift, - Key.LWin, Key.RWin, - }; - - if (invalidKeys.Contains(key)) - { - return false; - } - if (ModifierKeys == ModifierKeys.None) - { - return key >= Key.F1 && key <= Key.F24; + switch (CharKey) + { + case Key.LeftAlt: + case Key.RightAlt: + case Key.LeftCtrl: + case Key.RightCtrl: + case Key.LeftShift: + case Key.RightShift: + case Key.LWin: + case Key.RWin: + return false; + default: + if (ModifierKeys == ModifierKeys.None) + { + return CharKey >= Key.F1 && CharKey <= Key.F24; + } + else + { + return CharKey != Key.None; + } } - return true; } public override bool Equals(object obj) { if (obj is HotkeyModel other) { - return ModifierKeys == other.ModifierKeys && CharKey == other.charKey; + return ModifierKeys == other.ModifierKeys && CharKey == other.CharKey; } else { From c03a0b031eb8a1105f6329e3a38eb375eff84fdb Mon Sep 17 00:00:00 2001 From: Vic <10308169+VictoriousRaptor@users.noreply.github.com> Date: Wed, 11 Jan 2023 16:13:39 +0800 Subject: [PATCH 09/14] Validate hotkey before setting --- Flow.Launcher/HotkeyControl.xaml.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Flow.Launcher/HotkeyControl.xaml.cs b/Flow.Launcher/HotkeyControl.xaml.cs index 7fac47e4d9e..e6d48290004 100644 --- a/Flow.Launcher/HotkeyControl.xaml.cs +++ b/Flow.Launcher/HotkeyControl.xaml.cs @@ -70,7 +70,7 @@ public async Task SetHotkeyAsync(HotkeyModel keyModel, bool triggerValidate = tr if (triggerValidate) { - bool hotkeyAvailable = keyModel.CharKey != Key.None && CheckHotkeyAvailability(keyModel); + bool hotkeyAvailable = CheckHotkeyAvailability(keyModel); SetMessage(hotkeyAvailable); OnHotkeyChanged(); @@ -88,7 +88,7 @@ public Task SetHotkeyAsync(string keyStr, bool triggerValidate = true) return SetHotkeyAsync(new HotkeyModel(keyStr), triggerValidate); } - private bool CheckHotkeyAvailability() => HotKeyMapper.CheckAvailability(CurrentHotkey); + private static bool CheckHotkeyAvailability(HotkeyModel hotkey) => hotkey.Validate() && HotKeyMapper.CheckAvailability(hotkey); public new bool IsFocused => tbHotkey.IsFocused; From 3f6ab55ae7904daabceee383bc0e1fbf065c2f32 Mon Sep 17 00:00:00 2001 From: Vic <10308169+VictoriousRaptor@users.noreply.github.com> Date: Wed, 11 Jan 2023 16:14:50 +0800 Subject: [PATCH 10/14] Use properties for hashcode --- Flow.Launcher.Infrastructure/Hotkey/HotkeyModel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Flow.Launcher.Infrastructure/Hotkey/HotkeyModel.cs b/Flow.Launcher.Infrastructure/Hotkey/HotkeyModel.cs index 0908a404b82..e1d29fb8157 100644 --- a/Flow.Launcher.Infrastructure/Hotkey/HotkeyModel.cs +++ b/Flow.Launcher.Infrastructure/Hotkey/HotkeyModel.cs @@ -177,7 +177,7 @@ public override bool Equals(object obj) public override int GetHashCode() { - return this.ToString().GetHashCode(); + return HashCode.Combine(ModifierKeys, CharKey); } } } From 28c5031bfb63967fe8697e3b6afe06241b12f981 Mon Sep 17 00:00:00 2001 From: Vic <10308169+VictoriousRaptor@users.noreply.github.com> Date: Wed, 11 Jan 2023 16:22:19 +0800 Subject: [PATCH 11/14] Maintain focus when hotkey invalid --- Flow.Launcher/HotkeyControl.xaml.cs | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/Flow.Launcher/HotkeyControl.xaml.cs b/Flow.Launcher/HotkeyControl.xaml.cs index e6d48290004..804d1d4cb33 100644 --- a/Flow.Launcher/HotkeyControl.xaml.cs +++ b/Flow.Launcher/HotkeyControl.xaml.cs @@ -63,14 +63,13 @@ private void TbHotkey_OnPreviewKeyDown(object sender, KeyEventArgs e) public async Task SetHotkeyAsync(HotkeyModel keyModel, bool triggerValidate = true) { - CurrentHotkey = keyModel; - - tbHotkey.Text = CurrentHotkey.ToString(); + tbHotkey.Text = keyModel.ToString(); tbHotkey.Select(tbHotkey.Text.Length, 0); if (triggerValidate) { bool hotkeyAvailable = CheckHotkeyAvailability(keyModel); + CurrentHotkeyAvailable = hotkeyAvailable; SetMessage(hotkeyAvailable); OnHotkeyChanged(); @@ -78,8 +77,18 @@ public async Task SetHotkeyAsync(HotkeyModel keyModel, bool triggerValidate = tr await Task.Delay(500, token); if (token.IsCancellationRequested) return; - FocusManager.SetFocusedElement(FocusManager.GetFocusScope(this), null); - Keyboard.ClearFocus(); + + if (CurrentHotkeyAvailable) + { + CurrentHotkey = keyModel; + // To trigger LostFocus + FocusManager.SetFocusedElement(FocusManager.GetFocusScope(this), null); + Keyboard.ClearFocus(); + } + } + else + { + CurrentHotkey = keyModel; } } @@ -94,7 +103,7 @@ public Task SetHotkeyAsync(string keyStr, bool triggerValidate = true) private void tbHotkey_LostFocus(object sender, RoutedEventArgs e) { - + } private void tbHotkey_GotFocus(object sender, RoutedEventArgs e) From 835370af34f6687fe1b1ace505ca9a97c7dd2a15 Mon Sep 17 00:00:00 2001 From: Vic <10308169+VictoriousRaptor@users.noreply.github.com> Date: Wed, 11 Jan 2023 19:28:42 +0800 Subject: [PATCH 12/14] Set text to current hotkey when lost focus --- Flow.Launcher/HotkeyControl.xaml.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Flow.Launcher/HotkeyControl.xaml.cs b/Flow.Launcher/HotkeyControl.xaml.cs index 804d1d4cb33..15feae6cc9a 100644 --- a/Flow.Launcher/HotkeyControl.xaml.cs +++ b/Flow.Launcher/HotkeyControl.xaml.cs @@ -103,7 +103,8 @@ public Task SetHotkeyAsync(string keyStr, bool triggerValidate = true) private void tbHotkey_LostFocus(object sender, RoutedEventArgs e) { - + tbHotkey.Text = CurrentHotkey.ToString(); + tbHotkey.Select(tbHotkey.Text.Length, 0); } private void tbHotkey_GotFocus(object sender, RoutedEventArgs e) From 203705bda1fc31ebdd30858274d8ae188e0f496c Mon Sep 17 00:00:00 2001 From: Vic <10308169+VictoriousRaptor@users.noreply.github.com> Date: Wed, 11 Jan 2023 20:08:13 +0800 Subject: [PATCH 13/14] Use compound assignment --- Flow.Launcher.Infrastructure/Hotkey/HotkeyModel.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Flow.Launcher.Infrastructure/Hotkey/HotkeyModel.cs b/Flow.Launcher.Infrastructure/Hotkey/HotkeyModel.cs index e1d29fb8157..61415dcb656 100644 --- a/Flow.Launcher.Infrastructure/Hotkey/HotkeyModel.cs +++ b/Flow.Launcher.Infrastructure/Hotkey/HotkeyModel.cs @@ -28,19 +28,19 @@ public ModifierKeys ModifierKeys ModifierKeys modifierKeys = ModifierKeys.None; if (Alt) { - modifierKeys = ModifierKeys.Alt; + modifierKeys |= ModifierKeys.Alt; } if (Shift) { - modifierKeys = modifierKeys | ModifierKeys.Shift; + modifierKeys |= ModifierKeys.Shift; } if (Win) { - modifierKeys = modifierKeys | ModifierKeys.Windows; + modifierKeys |= ModifierKeys.Windows; } if (Ctrl) { - modifierKeys = modifierKeys | ModifierKeys.Control; + modifierKeys |= ModifierKeys.Control; } return modifierKeys; } From 3a8162be49db1af2c2043d9f76582f10aa19766d Mon Sep 17 00:00:00 2001 From: Vic <10308169+VictoriousRaptor@users.noreply.github.com> Date: Thu, 12 Jan 2023 00:27:19 +0800 Subject: [PATCH 14/14] Ban alphanumeric keys --- Flow.Launcher.Infrastructure/Hotkey/HotkeyModel.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Flow.Launcher.Infrastructure/Hotkey/HotkeyModel.cs b/Flow.Launcher.Infrastructure/Hotkey/HotkeyModel.cs index 61415dcb656..b92bc020724 100644 --- a/Flow.Launcher.Infrastructure/Hotkey/HotkeyModel.cs +++ b/Flow.Launcher.Infrastructure/Hotkey/HotkeyModel.cs @@ -154,7 +154,9 @@ public bool Validate() default: if (ModifierKeys == ModifierKeys.None) { - return CharKey >= Key.F1 && CharKey <= Key.F24; + return !((CharKey >= Key.A && CharKey <= Key.Z) || + (CharKey >= Key.D0 && CharKey <= Key.D9) || + (CharKey >= Key.NumPad0 && CharKey <= Key.NumPad9)); } else {