Skip to content

Commit f19d1d6

Browse files
committed
allow plugin name to be searchable by Plugin Indicator
1 parent d577662 commit f19d1d6

File tree

3 files changed

+25
-25
lines changed

3 files changed

+25
-25
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
33
xmlns:system="clr-namespace:System;assembly=mscorlib">
44

5+
<system:String x:Key="flowlauncher_plugin_pluginindicator_result_subtitle">Activate {0} plugin action keyword</system:String>
6+
57
<system:String x:Key="flowlauncher_plugin_pluginindicator_plugin_name">Plugin Indicator</system:String>
68
<system:String x:Key="flowlauncher_plugin_pluginindicator_plugin_description">Provides plugins action words suggestions</system:String>
7-
8-
</ResourceDictionary>
9+
10+
</ResourceDictionary>

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

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,26 @@ public class Main : IPlugin, IPluginI18n
1010

1111
public List<Result> Query(Query query)
1212
{
13-
// if query contains more than one word, eg. github tips
14-
// user has decided to type something else rather than wanting to see the available action keywords
15-
if (query.SearchTerms.Length > 1)
16-
return new List<Result>();
17-
18-
var results = from keyword in PluginManager.NonGlobalPlugins.Keys
19-
where keyword.StartsWith(query.Search)
20-
let metadata = PluginManager.NonGlobalPlugins[keyword].Metadata
21-
where !metadata.Disabled
22-
select new Result
23-
{
24-
Title = keyword,
25-
SubTitle = $"Activate {metadata.Name} plugin",
26-
Score = 100,
27-
IcoPath = metadata.IcoPath,
28-
AutoCompleteText = $"{keyword}{Plugin.Query.TermSeparator}",
29-
Action = c =>
30-
{
31-
context.API.ChangeQuery($"{keyword}{Plugin.Query.TermSeparator}");
32-
return false;
33-
}
34-
};
13+
var results =
14+
from keyword in PluginManager.NonGlobalPlugins.Keys
15+
let metadata = PluginManager.NonGlobalPlugins[keyword].Metadata
16+
where (context.API.FuzzySearch(query.Search, keyword).IsSearchPrecisionScoreMet()
17+
|| context.API.FuzzySearch(query.Search, metadata.Name).IsSearchPrecisionScoreMet()
18+
|| string.IsNullOrEmpty(query.Search)) // To list all available action keywords
19+
&& !metadata.Disabled
20+
select new Result
21+
{
22+
Title = keyword,
23+
SubTitle = string.Format(context.API.GetTranslation("flowlauncher_plugin_pluginindicator_result_subtitle"), metadata.Name),
24+
Score = 100,
25+
IcoPath = metadata.IcoPath,
26+
AutoCompleteText = $"{keyword}{Plugin.Query.TermSeparator}",
27+
Action = c =>
28+
{
29+
context.API.ChangeQuery($"{keyword}{Plugin.Query.TermSeparator}");
30+
return false;
31+
}
32+
};
3533
return results.ToList();
3634
}
3735

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"Name": "Plugin Indicator",
55
"Description": "Provide plugin actionword suggestion",
66
"Author": "qianlifeng",
7-
"Version": "2.0.0",
7+
"Version": "2.0.1",
88
"Language": "csharp",
99
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
1010
"ExecuteFileName": "Flow.Launcher.Plugin.PluginIndicator.dll",

0 commit comments

Comments
 (0)