Skip to content

Commit 8c509ea

Browse files
committed
restrict to open flow hotkey control only
1 parent 66a2284 commit 8c509ea

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

Flow.Launcher.Infrastructure/Hotkey/HotkeyModel.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,10 @@ public bool Validate(bool validateKeyGestrue = false)
167167
case Key.RightCtrl:
168168
case Key.LeftShift:
169169
case Key.RightShift:
170+
case Key.LWin:
171+
case Key.RWin:
170172
case Key.None:
171173
return false;
172-
case Key.LWin when ModifierKeys == ModifierKeys.Windows:
173-
case Key.RWin when ModifierKeys == ModifierKeys.Windows:
174-
return true;
175174
default:
176175
if (validateKeyGestrue)
177176
{

Flow.Launcher/HotkeyControlDialog.xaml.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ public enum EResultType
3434
public string ResultValue { get; private set; } = string.Empty;
3535
public static string EmptyHotkey => InternationalizationManager.Instance.GetTranslation("none");
3636

37+
private static bool isOpenFlowHotkey;
38+
3739
public HotkeyControlDialog(string hotkey, string defaultHotkey, IHotkeySettings hotkeySettings, string windowTitle = "")
3840
{
3941
WindowTitle = windowTitle switch
@@ -48,6 +50,10 @@ public HotkeyControlDialog(string hotkey, string defaultHotkey, IHotkeySettings
4850

4951
InitializeComponent();
5052

53+
isOpenFlowHotkey = _hotkeySettings.RegisteredHotkeys
54+
.Any(x => x.DescriptionResourceKey == "flowlauncherHotkey"
55+
&& x.Hotkey.ToString() == hotkey);
56+
5157
ChefKeysManager.StartMenuEnableBlocking = true;
5258
ChefKeysManager.Start();
5359
}
@@ -181,8 +187,13 @@ private void SetKeysToDisplay(HotkeyModel? hotkey)
181187
}
182188
}
183189

184-
private static bool CheckHotkeyAvailability(HotkeyModel hotkey, bool validateKeyGesture) =>
185-
hotkey.Validate(validateKeyGesture) && HotKeyMapper.CheckAvailability(hotkey);
190+
private static bool CheckHotkeyAvailability(HotkeyModel hotkey, bool validateKeyGesture)
191+
{
192+
if (isOpenFlowHotkey && (hotkey.ToString() == "LWin" || hotkey.ToString() == "RWin"))
193+
return true;
194+
195+
return hotkey.Validate(validateKeyGesture) && HotKeyMapper.CheckAvailability(hotkey);
196+
}
186197

187198
private void Overwrite(object sender, RoutedEventArgs e)
188199
{

0 commit comments

Comments
 (0)