mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Merge branch 'dev' into rename-file
This commit is contained in:
commit
7fddfd961b
5 changed files with 33 additions and 9 deletions
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue