Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@
<system:String x:Key="plugin_explorer_Directory_Recursive_Search_Engine">Directory Recursive Search Engine</system:String>
<system:String x:Key="plugin_explorer_Index_Search_Engine">Index Search Engine</system:String>
<system:String x:Key="plugin_explorer_Open_Window_Index_Option">Open Windows Index Option</system:String>
<system:String x:Key="plugin_explorer_Excluded_File_Types">Excluded File Types (comma seperated)</system:String>
<system:String x:Key="plugin_explorer_Excluded_File_Types_Tooltip">For example: exe,jpg,png</system:String>

<!-- Plugin Infos -->
<system:String x:Key="plugin_explorer_plugin_name">Explorer</system:String>
Expand Down
15 changes: 14 additions & 1 deletion Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Threading;
using System.Threading.Tasks;
using Flow.Launcher.Plugin.Explorer.Exceptions;
using Path = System.IO.Path;

namespace Flow.Launcher.Plugin.Explorer.Search
{
Expand Down Expand Up @@ -109,7 +110,11 @@ when ActionKeywordMatch(query, Settings.ActionKeyword.IndexSearchActionKeyword)
try
{
await foreach (var search in searchResults.WithCancellation(token).ConfigureAwait(false))
results.Add(ResultManager.CreateResult(query, search));
if (search.Type == ResultType.File && IsExcludedFile(search)) {
continue;
} else {
results.Add(ResultManager.CreateResult(query, search));
}
}
catch (OperationCanceledException)
{
Expand Down Expand Up @@ -247,5 +252,13 @@ private bool UseWindowsIndexForDirectorySearch(string locationPath)
x => FilesFolders.ReturnPreviousDirectoryIfIncompleteString(pathToDirectory).StartsWith(x.Path, StringComparison.OrdinalIgnoreCase))
&& WindowsIndex.WindowsIndex.PathIsIndexed(pathToDirectory);
}

private bool IsExcludedFile(SearchResult result)
{
string[] excludedFileTypes = Settings.ExcludedFileTypes.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
string fileExtension = Path.GetExtension(result.FullPath).TrimStart('.');

return excludedFileTypes.Contains(fileExtension, StringComparer.OrdinalIgnoreCase);
}
}
}
2 changes: 2 additions & 0 deletions Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public class Settings

public string ShellPath { get; set; } = "cmd";

public string ExcludedFileTypes { get; set; } = "";


public bool UseLocationAsWorkingDir { get; set; } = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,18 @@ public string ShellPath
}
}

public string ExcludedFileTypes
{
get => Settings.ExcludedFileTypes;
set
{
// remove spaces and dots from the string before saving
string sanitized = string.IsNullOrEmpty(value) ? "" : value.Replace(" ", "").Replace(".", "");
Settings.ExcludedFileTypes = sanitized;
OnPropertyChanged();
}
}


#region Everything FastSortWarning

Expand Down
15 changes: 15 additions & 0 deletions Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock
Grid.Row="0"
Expand Down Expand Up @@ -333,6 +334,20 @@
DisplayMemberPath="Description"
ItemsSource="{Binding PathEnumerationEngines}"
SelectedItem="{Binding SelectedPathEnumerationEngine}" />
<TextBlock
Grid.Row="3"
Grid.Column="0"
Margin="0 15 20 0"
VerticalAlignment="Center"
Text="{DynamicResource plugin_explorer_Excluded_File_Types}"
TextBlock.Foreground="{DynamicResource Color05B}" />
<TextBox
Grid.Row="3"
Grid.Column="1"
MinWidth="350"
Margin="0,9,0,6"
ToolTip="{DynamicResource plugin_explorer_Excluded_File_Types_Tooltip}"
Text="{Binding ExcludedFileTypes}" />
</Grid>
</StackPanel>
<StackPanel Orientation="Horizontal">
Expand Down