diff --git a/Plugins/Flow.Launcher.Plugin.Calculator/plugin.json b/Plugins/Flow.Launcher.Plugin.Calculator/plugin.json index 485babd26..3168edfcc 100644 --- a/Plugins/Flow.Launcher.Plugin.Calculator/plugin.json +++ b/Plugins/Flow.Launcher.Plugin.Calculator/plugin.json @@ -2,11 +2,11 @@ "ID": "CEA0FDFC6D3B4085823D60DC76F28855", "ActionKeyword": "*", "Name": "Calculator", - "Description": "Provide mathematical calculations.(Try 5*3-2 in Flow Launcher)", + "Description": "Perform mathematical calculations (including hexadecimal values)", "Author": "cxfksword", "Version": "1.0.0", "Language": "csharp", "Website": "https://github.com/Flow-Launcher/Flow.Launcher", "ExecuteFileName": "Flow.Launcher.Plugin.Calculator.dll", "IcoPath": "Images\\calculator.png" -} \ No newline at end of file +} diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Main.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Main.cs index df2fed09f..9b1882cb3 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Main.cs @@ -17,7 +17,7 @@ namespace Flow.Launcher.Plugin.Explorer { internal static PluginInitContext Context { get; set; } - internal Settings Settings; + internal static Settings Settings { get; set; } private static readonly string ClassName = nameof(Main); diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/QuickAccessLinks/QuickAccess.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/QuickAccessLinks/QuickAccess.cs index 85b595390..32651ecb8 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/QuickAccessLinks/QuickAccess.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/QuickAccessLinks/QuickAccess.cs @@ -6,7 +6,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks { internal static class QuickAccess { - private const int quickAccessResultScore = 100; + private const int QuickAccessResultScore = 100; internal static List AccessLinkListMatched(Query query, IEnumerable accessLinks) { @@ -19,8 +19,9 @@ namespace Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks .ThenBy(x => x.Name) .Select(l => l.Type switch { - ResultType.Folder => ResultManager.CreateFolderResult(l.Name, l.Path, l.Path, query, quickAccessResultScore), - ResultType.File => ResultManager.CreateFileResult(l.Path, query, quickAccessResultScore), + ResultType.Volume => ResultManager.CreateDriveSpaceDisplayResult(l.Path, query.ActionKeyword, QuickAccessResultScore), + ResultType.Folder => ResultManager.CreateFolderResult(l.Name, l.Path, l.Path, query, QuickAccessResultScore), + ResultType.File => ResultManager.CreateFileResult(l.Path, query, QuickAccessResultScore), _ => throw new ArgumentOutOfRangeException() }) .ToList(); @@ -32,8 +33,9 @@ namespace Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks .ThenBy(x => x.Name) .Select(l => l.Type switch { - ResultType.Folder => ResultManager.CreateFolderResult(l.Name, l.Path, l.Path, query), - ResultType.File => ResultManager.CreateFileResult(l.Path, query, quickAccessResultScore), + ResultType.Volume => ResultManager.CreateDriveSpaceDisplayResult(l.Path, query.ActionKeyword, QuickAccessResultScore), + ResultType.Folder => ResultManager.CreateFolderResult(l.Name, l.Path, l.Path, query, QuickAccessResultScore), + ResultType.File => ResultManager.CreateFileResult(l.Path, query, QuickAccessResultScore), _ => throw new ArgumentOutOfRangeException() }).ToList(); } diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs index 83195a47f..9063217c1 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs @@ -137,7 +137,17 @@ namespace Flow.Launcher.Plugin.Explorer.Search }; } + internal static Result CreateDriveSpaceDisplayResult(string path, string actionKeyword, int score) + { + return CreateDriveSpaceDisplayResult(path, actionKeyword, score, SearchManager.UseIndexSearch(path)); + } + internal static Result CreateDriveSpaceDisplayResult(string path, string actionKeyword, bool windowsIndexed = false) + { + return CreateDriveSpaceDisplayResult(path, actionKeyword, 500, windowsIndexed); + } + + private static Result CreateDriveSpaceDisplayResult(string path, string actionKeyword, int score, bool windowsIndexed = false) { var progressBarColor = "#26a0da"; var title = string.Empty; // hide title when use progress bar, @@ -163,7 +173,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search SubTitle = subtitle, AutoCompleteText = GetPathWithActionKeyword(path, ResultType.Folder, actionKeyword), IcoPath = path, - Score = 500, + Score = score, ProgressBar = progressValue, ProgressBarColor = progressBarColor, Preview = new Result.PreviewInfo diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs index 12df6c145..f4f87d4d4 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs @@ -246,6 +246,18 @@ namespace Flow.Launcher.Plugin.Explorer.Search public bool IsFileContentSearch(string actionKeyword) => actionKeyword == Settings.FileContentSearchActionKeyword; + public static bool UseIndexSearch(string path) + { + if (Main.Settings.IndexSearchEngine is not Settings.IndexSearchEngineOption.WindowsIndex) + return false; + + // Check if the path is using windows index search + var pathToDirectory = FilesFolders.ReturnPreviousDirectoryIfIncompleteString(path); + + return !Main.Settings.IndexSearchExcludedSubdirectoryPaths.Any( + x => FilesFolders.ReturnPreviousDirectoryIfIncompleteString(pathToDirectory).StartsWith(x.Path, StringComparison.OrdinalIgnoreCase)) + && WindowsIndex.WindowsIndex.PathIsIndexed(pathToDirectory); + } private bool UseWindowsIndexForDirectorySearch(string locationPath) {