Skip to content

Commit 7fddfd9

Browse files
authored
Merge branch 'dev' into rename-file
2 parents 96b3645 + 1d2a7bf commit 7fddfd9

File tree

5 files changed

+33
-9
lines changed

5 files changed

+33
-9
lines changed

Plugins/Flow.Launcher.Plugin.Calculator/plugin.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
"ID": "CEA0FDFC6D3B4085823D60DC76F28855",
33
"ActionKeyword": "*",
44
"Name": "Calculator",
5-
"Description": "Provide mathematical calculations.(Try 5*3-2 in Flow Launcher)",
5+
"Description": "Perform mathematical calculations (including hexadecimal values)",
66
"Author": "cxfksword",
77
"Version": "1.0.0",
88
"Language": "csharp",
99
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
1010
"ExecuteFileName": "Flow.Launcher.Plugin.Calculator.dll",
1111
"IcoPath": "Images\\calculator.png"
12-
}
12+
}

Plugins/Flow.Launcher.Plugin.Explorer/Main.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public class Main : ISettingProvider, IAsyncPlugin, IContextMenu, IPluginI18n, I
1717
{
1818
internal static PluginInitContext Context { get; set; }
1919

20-
internal Settings Settings;
20+
internal static Settings Settings { get; set; }
2121

2222
private static readonly string ClassName = nameof(Main);
2323

Plugins/Flow.Launcher.Plugin.Explorer/Search/QuickAccessLinks/QuickAccess.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks
66
{
77
internal static class QuickAccess
88
{
9-
private const int quickAccessResultScore = 100;
9+
private const int QuickAccessResultScore = 100;
1010

1111
internal static List<Result> AccessLinkListMatched(Query query, IEnumerable<AccessLink> accessLinks)
1212
{
@@ -19,8 +19,9 @@ internal static List<Result> AccessLinkListMatched(Query query, IEnumerable<Acce
1919
.ThenBy(x => x.Name)
2020
.Select(l => l.Type switch
2121
{
22-
ResultType.Folder => ResultManager.CreateFolderResult(l.Name, l.Path, l.Path, query, quickAccessResultScore),
23-
ResultType.File => ResultManager.CreateFileResult(l.Path, query, quickAccessResultScore),
22+
ResultType.Volume => ResultManager.CreateDriveSpaceDisplayResult(l.Path, query.ActionKeyword, QuickAccessResultScore),
23+
ResultType.Folder => ResultManager.CreateFolderResult(l.Name, l.Path, l.Path, query, QuickAccessResultScore),
24+
ResultType.File => ResultManager.CreateFileResult(l.Path, query, QuickAccessResultScore),
2425
_ => throw new ArgumentOutOfRangeException()
2526
})
2627
.ToList();
@@ -32,8 +33,9 @@ internal static List<Result> AccessLinkListAll(Query query, IEnumerable<AccessLi
3233
.ThenBy(x => x.Name)
3334
.Select(l => l.Type switch
3435
{
35-
ResultType.Folder => ResultManager.CreateFolderResult(l.Name, l.Path, l.Path, query),
36-
ResultType.File => ResultManager.CreateFileResult(l.Path, query, quickAccessResultScore),
36+
ResultType.Volume => ResultManager.CreateDriveSpaceDisplayResult(l.Path, query.ActionKeyword, QuickAccessResultScore),
37+
ResultType.Folder => ResultManager.CreateFolderResult(l.Name, l.Path, l.Path, query, QuickAccessResultScore),
38+
ResultType.File => ResultManager.CreateFileResult(l.Path, query, QuickAccessResultScore),
3739
_ => throw new ArgumentOutOfRangeException()
3840
}).ToList();
3941
}

Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,17 @@ internal static Result CreateFolderResult(string title, string subtitle, string
137137
};
138138
}
139139

140+
internal static Result CreateDriveSpaceDisplayResult(string path, string actionKeyword, int score)
141+
{
142+
return CreateDriveSpaceDisplayResult(path, actionKeyword, score, SearchManager.UseIndexSearch(path));
143+
}
144+
140145
internal static Result CreateDriveSpaceDisplayResult(string path, string actionKeyword, bool windowsIndexed = false)
146+
{
147+
return CreateDriveSpaceDisplayResult(path, actionKeyword, 500, windowsIndexed);
148+
}
149+
150+
private static Result CreateDriveSpaceDisplayResult(string path, string actionKeyword, int score, bool windowsIndexed = false)
141151
{
142152
var progressBarColor = "#26a0da";
143153
var title = string.Empty; // hide title when use progress bar,
@@ -163,7 +173,7 @@ internal static Result CreateDriveSpaceDisplayResult(string path, string actionK
163173
SubTitle = subtitle,
164174
AutoCompleteText = GetPathWithActionKeyword(path, ResultType.Folder, actionKeyword),
165175
IcoPath = path,
166-
Score = 500,
176+
Score = score,
167177
ProgressBar = progressValue,
168178
ProgressBarColor = progressBarColor,
169179
Preview = new Result.PreviewInfo

Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,18 @@ private async Task<List<Result>> PathSearchAsync(Query query, CancellationToken
246246

247247
public bool IsFileContentSearch(string actionKeyword) => actionKeyword == Settings.FileContentSearchActionKeyword;
248248

249+
public static bool UseIndexSearch(string path)
250+
{
251+
if (Main.Settings.IndexSearchEngine is not Settings.IndexSearchEngineOption.WindowsIndex)
252+
return false;
253+
254+
// Check if the path is using windows index search
255+
var pathToDirectory = FilesFolders.ReturnPreviousDirectoryIfIncompleteString(path);
256+
257+
return !Main.Settings.IndexSearchExcludedSubdirectoryPaths.Any(
258+
x => FilesFolders.ReturnPreviousDirectoryIfIncompleteString(pathToDirectory).StartsWith(x.Path, StringComparison.OrdinalIgnoreCase))
259+
&& WindowsIndex.WindowsIndex.PathIsIndexed(pathToDirectory);
260+
}
249261

250262
private bool UseWindowsIndexForDirectorySearch(string locationPath)
251263
{

0 commit comments

Comments
 (0)