diff --git a/Flow.Launcher.Plugin/PluginHotkey.cs b/Flow.Launcher.Plugin/PluginHotkey.cs index 4ab6d6120..4067289e6 100644 --- a/Flow.Launcher.Plugin/PluginHotkey.cs +++ b/Flow.Launcher.Plugin/PluginHotkey.cs @@ -91,7 +91,7 @@ public class SearchWindowPluginHotkey : BasePluginHotkey } /// - /// An action that will be executed when the hotkey is triggered. + /// An action that will be executed when the hotkey is triggered and a result is selected. /// public Func Action { get; set; } = null; } diff --git a/Flow.Launcher/Helper/HotKeyMapper.cs b/Flow.Launcher/Helper/HotKeyMapper.cs index 9bbf7b92e..c2c69beff 100644 --- a/Flow.Launcher/Helper/HotKeyMapper.cs +++ b/Flow.Launcher/Helper/HotKeyMapper.cs @@ -256,15 +256,28 @@ internal static class HotKeyMapper existingCommand.Execute(null); } - foreach (var hotkeyModel in hotkeyModels) + var selectedResult = _mainViewModel.Results.SelectedItem?.Result; + // Check result nullability + if (selectedResult != null) { - var metadata = hotkeyModel.Metadata; - if (metadata.Disabled) - continue; + var pluginId = selectedResult.PluginID; + foreach (var hotkeyModel in hotkeyModels) + { + var metadata = hotkeyModel.Metadata; + var pluginHotkey = hotkeyModel.PluginHotkey; - var pluginHotkey = hotkeyModel.PluginHotkey; - if (pluginHotkey.Action?.Invoke(_mainViewModel.Results.SelectedItem?.Result) ?? false) - App.API.HideMainWindow(); + // Check plugin ID match + if (metadata.ID != pluginId) + continue; + + // Check plugin enabled state + if (metadata.Disabled) + continue; + + // Invoke action + if (pluginHotkey.Action?.Invoke(selectedResult) ?? false) + App.API.HideMainWindow(); + } } }); }