diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml
index a118e7ad0..71b16f159 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml
@@ -23,6 +23,7 @@
Path Explore Activation:
File Content Search:
Index Only Search:
+ (Disabled)
Explorer
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs
index 7a79fbb3a..e62fc822c 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs
@@ -46,12 +46,12 @@ namespace Flow.Launcher.Plugin.Explorer.Search
var result = new HashSet(PathEqualityComparator.Instance);
- if (ActionKeywordMatch(query, settings.PathSearchActionKeyword) || ActionKeywordMatch(query, settings.SearchActionKeyword))
+ if (ActionKeywordMatch(query, Settings.ActionKeyword.PathSearchActionKeyword) || ActionKeywordMatch(query, Settings.ActionKeyword.SearchActionKeyword))
{
result.UnionWith(await PathSearchAsync(query, token).ConfigureAwait(false));
}
- if ((ActionKeywordMatch(query, settings.IndexOnlySearchActionKeyword) || ActionKeywordMatch(query, settings.SearchActionKeyword)) &&
+ if ((ActionKeywordMatch(query, Settings.ActionKeyword.IndexOnlySearchActionKeyword) || ActionKeywordMatch(query, Settings.ActionKeyword.SearchActionKeyword)) &&
querySearch.Length > 0 &&
!querySearch.IsLocationPathString())
{
@@ -61,18 +61,21 @@ namespace Flow.Launcher.Plugin.Explorer.Search
return result.ToList();
}
- private bool ActionKeywordMatch(Query query, string allowedActionKeyword)
+ private bool ActionKeywordMatch(Query query, Settings.ActionKeyword allowedActionKeyword)
{
if (query.ActionKeyword == settings.IndexOnlySearchActionKeyword)
- return settings.IndexOnlySearchActionKeyword == allowedActionKeyword;
+ return Settings.ActionKeyword.IndexOnlySearchActionKeyword == allowedActionKeyword && settings.EnabledIndexOnlySearchKeyword;
if (query.ActionKeyword == settings.PathSearchActionKeyword)
- return settings.PathSearchActionKeyword == allowedActionKeyword;
+ return Settings.ActionKeyword.PathSearchActionKeyword == allowedActionKeyword && settings.EnabledPathSearchKeyword;
if (query.ActionKeyword == settings.SearchActionKeyword)
- return settings.SearchActionKeyword == allowedActionKeyword;
+ return Settings.ActionKeyword.SearchActionKeyword == allowedActionKeyword;
- return Query.GlobalPluginWildcardSign == allowedActionKeyword;
+
+ return (Settings.ActionKeyword.IndexOnlySearchActionKeyword == allowedActionKeyword && settings.EnabledIndexOnlySearchKeyword)
+ || (Settings.ActionKeyword.PathSearchActionKeyword == allowedActionKeyword && settings.EnabledPathSearchKeyword)
+ || settings.SearchActionKeyword == Query.GlobalPluginWildcardSign;
}
public async Task> PathSearchAsync(Query query, CancellationToken token = default)
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs
index 99bc1bd8c..aaf4d2977 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs
@@ -23,6 +23,18 @@ namespace Flow.Launcher.Plugin.Explorer
public string PathSearchActionKeyword { get; set; } = Query.GlobalPluginWildcardSign;
+ public bool EnabledPathSearchKeyword { get; set; }
+
public string IndexOnlySearchActionKeyword { get; set; } = Query.GlobalPluginWildcardSign;
+
+ public bool EnabledIndexOnlySearchKeyword { get; set; }
+
+ internal enum ActionKeyword
+ {
+ SearchActionKeyword,
+ PathSearchActionKeyword,
+ FileContentSearchActionKeyword,
+ IndexOnlySearchActionKeyword
+ }
}
}
\ No newline at end of file
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml
index 0e1c7e872..b49ae3465 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml
@@ -16,6 +16,7 @@
+
@@ -23,8 +24,9 @@
Margin="10" Grid.Row="0" Width="105" Grid.Column="1"
VerticalAlignment="Center"
HorizontalAlignment="Left" />
-
-
+
+
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs
index e77000beb..f80ee4c84 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml.cs
@@ -33,6 +33,17 @@ namespace Flow.Launcher.Plugin.Explorer.Views
txtCurrentActionKeyword.Text = selectedActionKeyword.Keyword;
this.actionKeywordListView = actionKeywordListView;
+
+ // Search and File Content action keyword are not allowed to be disabled, they are the default search keywords.
+ if (currentActionKeyword.KeywordProperty == ActionKeywordProperty.SearchActionKeyword
+ || currentActionKeyword.KeywordProperty == ActionKeywordProperty.FileContentSearchActionKeyword)
+ chkActionKeywordEnabled.Visibility = Visibility.Collapsed;
+
+ if (currentActionKeyword.KeywordProperty == ActionKeywordProperty.IndexOnlySearchActionKeyword)
+ chkActionKeywordEnabled.IsChecked = this.settings.EnabledIndexOnlySearchKeyword;
+
+ if (currentActionKeyword.KeywordProperty == ActionKeywordProperty.PathSearchActionKeyword)
+ chkActionKeywordEnabled.IsChecked = this.settings.EnabledPathSearchKeyword;
}
private void OnConfirmButtonClick(object sender, RoutedEventArgs e)
@@ -42,6 +53,24 @@ namespace Flow.Launcher.Plugin.Explorer.Views
if (string.IsNullOrEmpty(newActionKeyword))
return;
+ if (currentActionKeyword.KeywordProperty == ActionKeywordProperty.IndexOnlySearchActionKeyword)
+ {
+ // reset to global so it does not take up an action keyword when disabled
+ if (!currentActionKeyword.Enabled && newActionKeyword != Query.GlobalPluginWildcardSign)
+ settingsViewModel.UpdateActionKeyword(currentActionKeyword.KeywordProperty, Query.GlobalPluginWildcardSign, currentActionKeyword.Keyword);
+
+ settings.EnabledIndexOnlySearchKeyword = currentActionKeyword.Enabled;
+ }
+
+ if (currentActionKeyword.KeywordProperty == ActionKeywordProperty.PathSearchActionKeyword)
+ {
+ // reset to global so it does not take up an action keyword when disabled
+ if (!currentActionKeyword.Enabled && newActionKeyword != Query.GlobalPluginWildcardSign)
+ settingsViewModel.UpdateActionKeyword(currentActionKeyword.KeywordProperty, Query.GlobalPluginWildcardSign, currentActionKeyword.Keyword);
+
+ settings.EnabledPathSearchKeyword = currentActionKeyword.Enabled;
+ }
+
if (newActionKeyword == currentActionKeyword.Keyword)
{
Close();
@@ -63,6 +92,15 @@ namespace Flow.Launcher.Plugin.Explorer.Views
actionKeywordListView.FirstOrDefault(x => x.Description == currentActionKeyword.Description).Keyword = newActionKeyword;
+ // automatically help users set this to enabled if an action keyword is set and currently disabled
+ if (currentActionKeyword.KeywordProperty == ActionKeywordProperty.IndexOnlySearchActionKeyword
+ && !settings.EnabledIndexOnlySearchKeyword)
+ settings.EnabledIndexOnlySearchKeyword = true;
+
+ if (currentActionKeyword.KeywordProperty == ActionKeywordProperty.PathSearchActionKeyword
+ && !settings.EnabledPathSearchKeyword)
+ settings.EnabledPathSearchKeyword = true;
+
Close();
return;
@@ -77,5 +115,14 @@ namespace Flow.Launcher.Plugin.Explorer.Views
return;
}
+ private void OnActionKeywordEnabledChecked(object sender, RoutedEventArgs e)
+ {
+ currentActionKeyword.Enabled = true;
+ }
+
+ private void OnActionKeywordEnabledUnChecked(object sender, RoutedEventArgs e)
+ {
+ currentActionKeyword.Enabled = false;
+ }
}
}
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs
index 191f35d76..d0c51d0d7 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs
@@ -38,26 +38,36 @@ namespace Flow.Launcher.Plugin.Explorer.Views
new ()
{
Description = viewModel.Context.API.GetTranslation("plugin_explorer_actionkeywordview_search"),
- Keyword = this.viewModel.Settings.SearchActionKeyword,
- KeywordProperty = ActionKeywordProperty.SearchActionKeyword
+ Keyword = viewModel.Settings.SearchActionKeyword,
+ KeywordProperty = ActionKeywordProperty.SearchActionKeyword,
+ Enabled = true
},
new ()
{
Description = viewModel.Context.API.GetTranslation("plugin_explorer_actionkeywordview_filecontentsearch"),
- Keyword = this.viewModel.Settings.FileContentSearchActionKeyword,
- KeywordProperty = ActionKeywordProperty.FileContentSearchActionKeyword
+ Keyword = viewModel.Settings.FileContentSearchActionKeyword,
+ KeywordProperty = ActionKeywordProperty.FileContentSearchActionKeyword,
+ Enabled = true
},
new ()
{
- Description = viewModel.Context.API.GetTranslation("plugin_explorer_actionkeywordview_path"),
- Keyword = this.viewModel.Settings.PathSearchActionKeyword,
- KeywordProperty = ActionKeywordProperty.PathSearchActionKeyword
+ Description = viewModel.Settings.EnabledPathSearchKeyword
+ ? viewModel.Context.API.GetTranslation("plugin_explorer_actionkeywordview_path")
+ : viewModel.Context.API.GetTranslation("plugin_explorer_actionkeywordview_path")
+ + " " + viewModel.Context.API.GetTranslation("plugin_explorer_actionkeywordview_brackets_disabled"),
+ Keyword = viewModel.Settings.PathSearchActionKeyword,
+ KeywordProperty = ActionKeywordProperty.PathSearchActionKeyword,
+ Enabled = viewModel.Settings.EnabledPathSearchKeyword
},
new ()
{
- Description = viewModel.Context.API.GetTranslation("plugin_explorer_actionkeywordview_indexonlysearch"),
- Keyword = this.viewModel.Settings.IndexOnlySearchActionKeyword,
- KeywordProperty = ActionKeywordProperty.IndexOnlySearchActionKeyword
+ Description = viewModel.Settings.EnabledIndexOnlySearchKeyword
+ ? viewModel.Context.API.GetTranslation("plugin_explorer_actionkeywordview_indexonlysearch")
+ : viewModel.Context.API.GetTranslation("plugin_explorer_actionkeywordview_indexonlysearch")
+ + " " + viewModel.Context.API.GetTranslation("plugin_explorer_actionkeywordview_brackets_disabled"),
+ Keyword = viewModel.Settings.IndexOnlySearchActionKeyword,
+ KeywordProperty = ActionKeywordProperty.IndexOnlySearchActionKeyword,
+ Enabled = viewModel.Settings.EnabledIndexOnlySearchKeyword
}
};
@@ -330,6 +340,9 @@ namespace Flow.Launcher.Plugin.Explorer.Views
public string Description { get; set; }
public ActionKeywordProperty KeywordProperty { get; init; }
+
public string Keyword { get; set; }
+
+ public bool Enabled { get; set; }
}
}