diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs b/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs
index ab9c8f10f..964a8897c 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs
@@ -7,6 +7,7 @@ using System.Windows;
using Flow.Launcher.Infrastructure.Logger;
using Flow.Launcher.Plugin.SharedCommands;
using Flow.Launcher.Plugin.Explorer.Search;
+using System.Windows.Media;
namespace Flow.Launcher.Plugin.Explorer
{
@@ -18,9 +19,10 @@ namespace Flow.Launcher.Plugin.Explorer
if (selectedResult.ContextData is SearchResult record)
{
if (record.Type == ResultType.File)
- {
contextMenus.Add(CreateOpenWithEditorResult(record));
- }
+
+ if (record.Type == ResultType.Folder && record.WindowsIndexed)
+ contextMenus.Add(CreateAddToIndexSearchExclusionListResult(record));
contextMenus.Add(CreateOpenContainingFolderResult(record));
@@ -154,7 +156,6 @@ namespace Flow.Launcher.Plugin.Explorer
};
}
-
private Result CreateOpenWithEditorResult(SearchResult record)
{
string editorPath = "notepad.exe"; // TODO add the ability to create a custom editor
@@ -182,6 +183,22 @@ namespace Flow.Launcher.Plugin.Explorer
};
}
+ private Result CreateAddToIndexSearchExclusionListResult(SearchResult record)
+ {
+ return new Result
+ {
+ Title = "Exclude path from index search",
+ SubTitle = record.FullPath,
+ Action = _ =>
+ {
+ Main.Settings.IndexSearchExcludedDirectories.Add(record.FullPath);
+
+ return false;
+ },
+ IcoPath = Constants.ExcludeFromIndexImagePath
+ };
+ }
+
public void LogException(string message, Exception e)
{
Log.Exception($"|Flow.Launcher.Plugin.Folder.ContextMenu|{message}", e);
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj b/Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj
index 3f3206567..65eed12d6 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj
@@ -31,6 +31,10 @@
PreserveNewest
+
+
+ PreserveNewest
+
PreserveNewest
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Images/excludeindexpath.png b/Plugins/Flow.Launcher.Plugin.Explorer/Images/excludeindexpath.png
new file mode 100644
index 000000000..8578ac7fb
Binary files /dev/null and b/Plugins/Flow.Launcher.Plugin.Explorer/Images/excludeindexpath.png differ
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Main.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Main.cs
index 8bd6812d2..18691c579 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Main.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Main.cs
@@ -1,4 +1,4 @@
-using Flow.Launcher.Infrastructure.Storage;
+using Flow.Launcher.Infrastructure.Storage;
using Flow.Launcher.Plugin.Explorer.Search;
using Flow.Launcher.Plugin.Explorer.ViewModels;
using Flow.Launcher.Plugin.Explorer.Views;
@@ -12,7 +12,7 @@ namespace Flow.Launcher.Plugin.Explorer
{
internal static PluginInitContext Context { get; set; }
- private Settings _settings;
+ internal static Settings Settings;
private SettingsViewModel _viewModel;
@@ -27,7 +27,7 @@ namespace Flow.Launcher.Plugin.Explorer
{
Context = context;
_viewModel = new SettingsViewModel();
- _settings = _viewModel.Settings;
+ Settings = _viewModel.Settings;
_contextMenu = new ContextMenu();
}
@@ -43,7 +43,7 @@ namespace Flow.Launcher.Plugin.Explorer
if (string.IsNullOrEmpty(query.Search))
return results;
- return new SearchManager(_settings, Context).Search(query);
+ return new SearchManager(Settings, Context).Search(query);
}
public void Save()
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/Constants.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/Constants.cs
index a299f24c3..2f6a6f2ea 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/Constants.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/Constants.cs
@@ -11,6 +11,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
internal const string DeleteFileFolderImagePath = "Images\\deletefilefolder.png";
internal const string CopyImagePath = "Images\\copy.png";
internal const string IndexImagePath = "Images\\index.png";
+ internal const string ExcludeFromIndexImagePath = "Images\\excludeindexpath.png";
internal const string DefaultFolderSubtitleString = "Ctrl + Enter to open the directory";
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs
index 33d255ae0..1ffc9ee51 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs
@@ -112,8 +112,8 @@ namespace Flow.Launcher.Plugin.Explorer.Search
if (!_settings.UseWindowsIndexForDirectorySearch)
return false;
- if (_settings.WindowsIndexExcludedDirectories
- .Any(x => x.Path == FilesFolders.ReturnPreviousDirectoryIfIncompleteString(locationPath)))
+ if (_settings.IndexSearchExcludedDirectories
+ .Any(x => x == FilesFolders.ReturnPreviousDirectoryIfIncompleteString(locationPath)))
return false;
return _indexSearch.PathIsIndexed(locationPath);
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs
index abe452481..53011bf18 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs
@@ -17,6 +17,6 @@ namespace Flow.Launcher.Plugin.Explorer
public bool UseWindowsIndexForDirectorySearch { get; set; } = true;
[JsonProperty]
- public List WindowsIndexExcludedDirectories { get; set; } = new List();
+ public List IndexSearchExcludedDirectories { get; set; } = new List();
}
}