Skip to content

Commit 0c58c2b

Browse files
Ban single character key
1 parent cd056f6 commit 0c58c2b

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

Flow.Launcher.Infrastructure/Hotkey/HotkeyModel.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Windows.Input;
5+
using System.Windows.Navigation;
56

67
namespace Flow.Launcher.Infrastructure.Hotkey
78
{
@@ -148,7 +149,7 @@ public override string ToString()
148149
return string.Join(" + ", keys);
149150
}
150151

151-
private static bool ValidateHotkey(Key key)
152+
private bool ValidateHotkey(Key key)
152153
{
153154
HashSet<Key> invalidKeys = new()
154155
{
@@ -158,7 +159,15 @@ private static bool ValidateHotkey(Key key)
158159
Key.LWin, Key.RWin,
159160
};
160161

161-
return !invalidKeys.Contains(key);
162+
if (invalidKeys.Contains(key))
163+
{
164+
return false;
165+
}
166+
if (ModifierKeys == ModifierKeys.None)
167+
{
168+
return key >= Key.F1 && key <= Key.F24;
169+
}
170+
return true;
162171
}
163172

164173
public override bool Equals(object obj)

0 commit comments

Comments
 (0)