diff --git a/Flow.Launcher.Core/Plugin/PluginManager.cs b/Flow.Launcher.Core/Plugin/PluginManager.cs
index 9183adc7b..8d2c6df24 100644
--- a/Flow.Launcher.Core/Plugin/PluginManager.cs
+++ b/Flow.Launcher.Core/Plugin/PluginManager.cs
@@ -252,6 +252,8 @@ namespace Flow.Launcher.Core.Plugin
public static bool ActionKeywordRegistered(string actionKeyword)
{
+ // this method is only checking for action keywords (defined as not '*') registration
+ // hence the actionKeyword != Query.GlobalPluginWildcardSign logic
return actionKeyword != Query.GlobalPluginWildcardSign
&& NonGlobalPlugins.ContainsKey(actionKeyword);
}
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml
index 445326a76..24a591c4f 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml
@@ -23,6 +23,10 @@
Path Search:
File Content Search:
Index Search:
+ Current Action Keyword:
+ Done
+ Enabled
+ When disabled Flow will not execute this search option, and will additionally revert back to '*' to free up the action keyword
Explorer
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs
index 8e67277a8..6f3996b0d 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs
@@ -67,7 +67,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
private bool ActionKeywordMatch(Query query, Settings.ActionKeyword allowedActionKeyword)
{
- var keyword = query.ActionKeyword.Length == 0 ? "*" : query.ActionKeyword;
+ var keyword = query.ActionKeyword.Length == 0 ? Query.GlobalPluginWildcardSign : query.ActionKeyword;
return allowedActionKeyword switch
{
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs
index fbf9c325e..0fed15fc4 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs
@@ -62,7 +62,14 @@ namespace Flow.Launcher.Plugin.Explorer.ViewModels
}
}
- internal bool IsActionKeywordAlreadyAssigned(string newActionKeyword) => PluginManager.ActionKeywordRegistered(newActionKeyword);
+ internal bool IsActionKeywordAlreadyAssigned(string newActionKeyword, string oldActionKeyword)
+ {
+ // PluginManager.ActionKeywordRegistered does not check global action keyword ('*'), so use this logic instead
+ if (newActionKeyword == Query.GlobalPluginWildcardSign)
+ return newActionKeyword == oldActionKeyword;
+
+ return PluginManager.ActionKeywordRegistered(newActionKeyword);
+ }
internal bool IsNewActionKeywordGlobal(string newActionKeyword) => newActionKeyword == Query.GlobalPluginWildcardSign;
}
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml
index 52df61a5f..af67f1727 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml
@@ -20,23 +20,19 @@
+ HorizontalAlignment="Left" Text="{DynamicResource plugin_explorer_actionkeyword_current}" />
-
-
-
-
-
+
\ No newline at end of file
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs
index 240605ecd..24b00f956 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs
@@ -1,4 +1,4 @@
-using Flow.Launcher.Plugin.Explorer.ViewModels;
+using Flow.Launcher.Plugin.Explorer.ViewModels;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
@@ -14,6 +14,8 @@ namespace Flow.Launcher.Plugin.Explorer.Views
public ActionKeywordView CurrentActionKeyword { get; set; }
+ private string oldActionKeyword;
+
private List actionKeywordListView;
private Settings settings;
@@ -30,32 +32,20 @@ namespace Flow.Launcher.Plugin.Explorer.Views
CurrentActionKeyword = selectedActionKeyword;
+ oldActionKeyword = selectedActionKeyword.Keyword;
+
this.actionKeywordListView = actionKeywordListView;
InitializeComponent();
}
- private void OnConfirmButtonClick(object sender, RoutedEventArgs e)
+ private void OnDoneButtonClick(object sender, RoutedEventArgs e)
{
- var newActionKeyword = TxtCurrentActionKeyword.Text;
-
- if (string.IsNullOrEmpty(newActionKeyword))
+ if (string.IsNullOrEmpty(CurrentActionKeyword.Keyword))
return;
- // reset to global so it does not take up an action keyword when disabled
- if (!CurrentActionKeyword.Enabled is not null && newActionKeyword != Query.GlobalPluginWildcardSign)
- settingsViewModel.UpdateActionKeyword(CurrentActionKeyword.KeywordProperty,
- Query.GlobalPluginWildcardSign, CurrentActionKeyword.Keyword);
-
- if (newActionKeyword == CurrentActionKeyword.Keyword)
- {
- Close();
-
- return;
- }
-
- if (settingsViewModel.IsNewActionKeywordGlobal(newActionKeyword)
+ if (settingsViewModel.IsNewActionKeywordGlobal(CurrentActionKeyword.Keyword)
&& CurrentActionKeyword.KeywordProperty == Settings.ActionKeyword.FileContentSearchActionKeyword)
{
MessageBox.Show(
@@ -64,13 +54,12 @@ namespace Flow.Launcher.Plugin.Explorer.Views
return;
}
- if (!settingsViewModel.IsActionKeywordAlreadyAssigned(newActionKeyword))
+ if (!settingsViewModel.IsActionKeywordAlreadyAssigned(CurrentActionKeyword.Keyword, oldActionKeyword))
{
- settingsViewModel.UpdateActionKeyword(CurrentActionKeyword.KeywordProperty, newActionKeyword,
- CurrentActionKeyword.Keyword);
+ settingsViewModel.UpdateActionKeyword(CurrentActionKeyword.KeywordProperty, CurrentActionKeyword.Keyword, oldActionKeyword);
actionKeywordListView.FirstOrDefault(x => x.Description == CurrentActionKeyword.Description).Keyword =
- newActionKeyword;
+ CurrentActionKeyword.Keyword;
// automatically help users set this to enabled if an action keyword is set and currently disabled
if (CurrentActionKeyword.KeywordProperty == Settings.ActionKeyword.IndexSearchActionKeyword
@@ -81,16 +70,19 @@ namespace Flow.Launcher.Plugin.Explorer.Views
&& !settings.EnabledPathSearchKeyword)
settings.EnabledPathSearchKeyword = true;
+ if (CurrentActionKeyword.KeywordProperty == Settings.ActionKeyword.SearchActionKeyword
+ && !settings.EnableSearchActionKeyword)
+ settings.EnableSearchActionKeyword = true;
+
Close();
return;
}
- MessageBox.Show(settingsViewModel.Context.API.GetTranslation("newActionKeywordsHasBeenAssigned"));
- }
+ // reset to global so it does not take up an action keyword when disabled
+ if (CurrentActionKeyword.Enabled is not null && CurrentActionKeyword.Enabled == false && CurrentActionKeyword.Keyword != Query.GlobalPluginWildcardSign)
+ settingsViewModel.UpdateActionKeyword(CurrentActionKeyword.KeywordProperty, Query.GlobalPluginWildcardSign, oldActionKeyword);
- private void OnCancelButtonClick(object sender, RoutedEventArgs e)
- {
Close();
return;