Skip to content

Commit 30dbdb8

Browse files
committed
Option to exclude quick access from results
1 parent a4d3c80 commit 30dbdb8

File tree

4 files changed

+23
-6
lines changed

4 files changed

+23
-6
lines changed

Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
<system:String x:Key="plugin_explorer_add">Add</system:String>
3333
<system:String x:Key="plugin_explorer_generalsetting_header">General Setting</system:String>
3434
<system:String x:Key="plugin_explorer_manageactionkeywords_header">Customise Action Keywords</system:String>
35+
<system:String x:Key="plugin_explorer_exclude_quickaccess_from_actionkeywords">Exclude Quick Access results when using action keywords</system:String>
3536
<system:String x:Key="plugin_explorer_manage_quick_access_links_header">Customise Quick Access</system:String>
3637
<system:String x:Key="plugin_explorer_quickaccesslinks_header">Quick Access Links</system:String>
3738
<system:String x:Key="plugin_explorer_everything_setting_header">Everything Setting</system:String>

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ internal async Task<List<Result>> SearchAsync(Query query, CancellationToken tok
6060

6161
if (activeActionKeyword == null && !isPathSearch)
6262
{
63-
MergeQuickAccessInResultsIfQueryMatch(results, query);
63+
MergeQuickAccessInResultsIfQueryMatch(results, query, activeActionKeyword);
6464
return results.ToList();
6565
}
6666

@@ -105,7 +105,7 @@ when activeActionKeyword.Equals(ActionKeyword.QuickAccessActionKeyword):
105105
}
106106

107107
// Merge Quick Access Link results for non-path searches.
108-
MergeQuickAccessInResultsIfQueryMatch(results, query);
108+
MergeQuickAccessInResultsIfQueryMatch(results, query, activeActionKeyword);
109109
try
110110
{
111111
await foreach (var search in searchResults.WithCancellation(token).ConfigureAwait(false))
@@ -279,8 +279,12 @@ private bool ShouldSkip(ActionKeyword actionKeywordActive, SearchResult search)
279279
return false;
280280
}
281281

282-
private void MergeQuickAccessInResultsIfQueryMatch(HashSet<Result> results, Query query)
282+
private void MergeQuickAccessInResultsIfQueryMatch(HashSet<Result> results, Query query, ActionKeyword? activeActionKeyword)
283283
{
284+
if (activeActionKeyword != null && activeActionKeyword != ActionKeyword.QuickAccessActionKeyword)
285+
{
286+
if (Settings.ExcludeQuickAccessFromActionKeywords) return;
287+
}
284288
var quickAccessMatched = QuickAccess.AccessLinkListMatched(query, Settings.QuickAccessLinks);
285289
if (quickAccessMatched != null && quickAccessMatched.Any()) results.UnionWith(quickAccessMatched);
286290
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ public class Settings
6868

6969
public bool FileSearchKeywordEnabled { get; set; }
7070

71+
public bool ExcludeQuickAccessFromActionKeywords { get; set; } = false;
72+
7173
public bool WarnWindowsSearchServiceOff { get; set; } = true;
7274

7375
public bool ShowFileSizeInPreviewPanel { get; set; } = true;

Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -674,17 +674,27 @@
674674
<Grid.RowDefinitions>
675675
<RowDefinition Height="Auto" />
676676
<RowDefinition Height="Auto" />
677+
<RowDefinition Height="Auto" />
677678
</Grid.RowDefinitions>
678-
<Grid.ColumnDefinitions>
679+
<Grid.ColumnDefinitions>
679680
<ColumnDefinition Width="Auto" />
680681
<ColumnDefinition Width="*" />
681682
</Grid.ColumnDefinitions>
682683

683-
<Border
684+
<CheckBox
684685
Grid.Row="0"
685686
Grid.Column="0"
686687
Grid.ColumnSpan="2"
687688
Margin="{StaticResource SettingPanelItemTopBottomMargin}"
689+
HorizontalAlignment="Left"
690+
Content="{DynamicResource plugin_explorer_exclude_quickaccess_from_actionkeywords}"
691+
IsChecked="{Binding Settings.ExcludeQuickAccessFromActionKeywords}" />
692+
693+
<Border
694+
Grid.Row="1"
695+
Grid.Column="0"
696+
Grid.ColumnSpan="2"
697+
Margin="{StaticResource SettingPanelItemTopBottomMargin}"
688698
HorizontalAlignment="Stretch"
689699
BorderBrush="{DynamicResource PopupButtonAreaBorderColor}"
690700
BorderThickness="1">
@@ -695,7 +705,7 @@
695705
</Border>
696706

697707
<StackPanel
698-
Grid.Row="1"
708+
Grid.Row="2"
699709
Grid.Column="0"
700710
Grid.ColumnSpan="2"
701711
Margin="{StaticResource SettingPanelItemTopBottomMargin}"

0 commit comments

Comments
 (0)