diff --git a/Flow.Launcher.Core/Plugin/PluginManager.cs b/Flow.Launcher.Core/Plugin/PluginManager.cs index c8f78767c..d0e6fcab0 100644 --- a/Flow.Launcher.Core/Plugin/PluginManager.cs +++ b/Flow.Launcher.Core/Plugin/PluginManager.cs @@ -340,11 +340,11 @@ namespace Flow.Launcher.Core.Plugin return results; } - public static bool ActionKeywordRegistered(IReadOnlyList actionKeywords) + public static bool ActionKeywordRegistered(IReadOnlyList newActionKeywords, IReadOnlyList oldActionKeywords) { - foreach (var actionKeyword in actionKeywords) + foreach (var actionKeyword in newActionKeywords) { - if (ActionKeywordRegistered(actionKeyword)) + if (ActionKeywordRegistered(actionKeyword, oldActionKeywords)) { return true; } @@ -352,6 +352,12 @@ namespace Flow.Launcher.Core.Plugin return false; } + private static bool ActionKeywordRegistered(string actionKeyword, IReadOnlyList oldActionKeywords) + { + if (oldActionKeywords.Contains(actionKeyword)) return false; + return ActionKeywordRegistered(actionKeyword); + } + public static bool ActionKeywordRegistered(string actionKeyword) { // this method is only checking for action keywords (defined as not '*') registration diff --git a/Flow.Launcher/ActionKeywords.xaml.cs b/Flow.Launcher/ActionKeywords.xaml.cs index 4a6bd10a8..af6dcfe90 100644 --- a/Flow.Launcher/ActionKeywords.xaml.cs +++ b/Flow.Launcher/ActionKeywords.xaml.cs @@ -4,6 +4,7 @@ using Flow.Launcher.Plugin; using Flow.Launcher.ViewModel; using Flow.Launcher.Core; using System.Linq; +using Flow.Launcher.Core.Plugin; namespace Flow.Launcher { @@ -41,7 +42,7 @@ namespace Flow.Launcher newActionKeywords = newActionKeywords.Count > 0 ? newActionKeywords : new() { Query.GlobalPluginWildcardSign }; - if (!PluginViewModel.IsActionKeywordRegistered(newActionKeywords)) + if (!PluginManager.ActionKeywordRegistered(newActionKeywords, oldActionKeywords)) { pluginViewModel.ChangeActionKeyword(newActionKeywords, oldActionKeywords); Close(); diff --git a/Flow.Launcher/ViewModel/PluginViewModel.cs b/Flow.Launcher/ViewModel/PluginViewModel.cs index 748490c47..63263c768 100644 --- a/Flow.Launcher/ViewModel/PluginViewModel.cs +++ b/Flow.Launcher/ViewModel/PluginViewModel.cs @@ -151,8 +151,6 @@ namespace Flow.Launcher.ViewModel PluginManager.API.ShowMainWindow(); } - public static bool IsActionKeywordRegistered(IReadOnlyList newActionKeywords) => PluginManager.ActionKeywordRegistered(newActionKeywords); - [RelayCommand] private void SetActionKeywords() {