Merge branch 'dev' into rename-file

This commit is contained in:
Jack Ye 2025-06-28 18:28:04 +08:00 committed by GitHub
commit 7fddfd961b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 33 additions and 9 deletions

View file

@ -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"
}
}

View file

@ -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);

View file

@ -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<Result> AccessLinkListMatched(Query query, IEnumerable<AccessLink> 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();
}

View file

@ -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

View file

@ -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)
{