Skip to content

Commit

Permalink
feat: Everything Run Count option
Browse files Browse the repository at this point in the history
Added an option in Explorer > Everything Settings to enable/disable Run Count for file/folder.
  • Loading branch information
z1nc0r3 committed Jul 15, 2024
1 parent ec17b3d commit c79b512
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 5 deletions.
1 change: 1 addition & 0 deletions Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
<system:String x:Key="flowlauncher_plugin_everything_nonfastsort_warning">Warning: This is not a Fast Sort option, searches may be slow</system:String>

<system:String x:Key="flowlauncher_plugin_everything_search_fullpath">Search Full Path</system:String>
<system:String x:Key="flowlauncher_plugin_everything_enable_run_count">Enable File/Folder Run Count</system:String>

<system:String x:Key="flowlauncher_plugin_everything_click_to_launch_or_install">Click to launch or install Everything</system:String>
<system:String x:Key="flowlauncher_plugin_everything_installing_title">Everything Installation</system:String>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public async IAsyncEnumerable<SearchResult> SearchAsync(string search, [Enumerat
if (token.IsCancellationRequested)
yield break;

var option = new EverythingSearchOption(search, Settings.SortOption, IsFullPathSearch: Settings.EverythingSearchFullPath);
var option = new EverythingSearchOption(search, Settings.SortOption, IsFullPathSearch: Settings.EverythingSearchFullPath, IsRunCounterEnabled: Settings.EverythingEnableRunCount);

await foreach (var result in EverythingApi.SearchAsync(option, token))
yield return result;
Expand Down Expand Up @@ -96,7 +96,8 @@ public async IAsyncEnumerable<SearchResult> ContentSearchAsync(string plainSearc
Settings.SortOption,
IsContentSearch: true,
ContentSearchKeyword: contentSearch,
IsFullPathSearch: Settings.EverythingSearchFullPath);
IsFullPathSearch: Settings.EverythingSearchFullPath,
IsRunCounterEnabled: Settings.EverythingEnableRunCount);

await foreach (var result in EverythingApi.SearchAsync(option, token))
{
Expand All @@ -115,7 +116,8 @@ public async IAsyncEnumerable<SearchResult> EnumerateAsync(string path, string s
Settings.SortOption,
ParentPath: path,
IsRecursive: recursive,
IsFullPathSearch: Settings.EverythingSearchFullPath);
IsFullPathSearch: Settings.EverythingSearchFullPath,
IsRunCounterEnabled: Settings.EverythingEnableRunCount);

await foreach (var result in EverythingApi.SearchAsync(option, token))
yield return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public record struct EverythingSearchOption(
bool IsRecursive = true,
int Offset = 0,
int MaxCount = 100,
bool IsFullPathSearch = true
bool IsFullPathSearch = true,
bool IsRunCounterEnabled = true
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ private static void OpenFolder(string folderPath, string fileNameOrFilePath = nu

private static void IncrementEverythingRunCounterIfNeeded(string fileOrFolder)
{
if (Settings.EverythingEnabled)
if (Settings.EverythingEnabled && Settings.EverythingEnableRunCount)
_ = Task.Run(() => EverythingApi.IncrementRunCounterAsync(fileOrFolder));
}

Expand Down
1 change: 1 addition & 0 deletions Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ public enum ContentIndexSearchEngineOption
ContentSearchEngine == ContentIndexSearchEngineOption.Everything;

public bool EverythingSearchFullPath { get; set; } = false;
public bool EverythingEnableRunCount { get; set; } = true;

#endregion

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,11 @@
HorizontalAlignment="Left"
Content="{DynamicResource flowlauncher_plugin_everything_search_fullpath}"
IsChecked="{Binding Settings.EverythingSearchFullPath}" />
<CheckBox
Margin="20 10 0 0"
HorizontalAlignment="Left"
Content="{DynamicResource flowlauncher_plugin_everything_enable_run_count}"
IsChecked="{Binding Settings.EverythingEnableRunCount}" />
<StackPanel Orientation="Horizontal">
<Grid Margin="20 10 0 10">
<Grid.ColumnDefinitions>
Expand Down

0 comments on commit c79b512

Please sign in to comment.