mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
allow plugin name to be searchable by Plugin Indicator
This commit is contained in:
parent
d577662d05
commit
f19d1d624d
3 changed files with 25 additions and 25 deletions
|
|
@ -2,7 +2,9 @@
|
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||
|
||||
<system:String x:Key="flowlauncher_plugin_pluginindicator_result_subtitle">Activate {0} plugin action keyword</system:String>
|
||||
|
||||
<system:String x:Key="flowlauncher_plugin_pluginindicator_plugin_name">Plugin Indicator</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_pluginindicator_plugin_description">Provides plugins action words suggestions</system:String>
|
||||
|
||||
</ResourceDictionary>
|
||||
|
||||
</ResourceDictionary>
|
||||
|
|
|
|||
|
|
@ -10,28 +10,26 @@ namespace Flow.Launcher.Plugin.PluginIndicator
|
|||
|
||||
public List<Result> Query(Query query)
|
||||
{
|
||||
// if query contains more than one word, eg. github tips
|
||||
// user has decided to type something else rather than wanting to see the available action keywords
|
||||
if (query.SearchTerms.Length > 1)
|
||||
return new List<Result>();
|
||||
|
||||
var results = from keyword in PluginManager.NonGlobalPlugins.Keys
|
||||
where keyword.StartsWith(query.Search)
|
||||
let metadata = PluginManager.NonGlobalPlugins[keyword].Metadata
|
||||
where !metadata.Disabled
|
||||
select new Result
|
||||
{
|
||||
Title = keyword,
|
||||
SubTitle = $"Activate {metadata.Name} plugin",
|
||||
Score = 100,
|
||||
IcoPath = metadata.IcoPath,
|
||||
AutoCompleteText = $"{keyword}{Plugin.Query.TermSeparator}",
|
||||
Action = c =>
|
||||
{
|
||||
context.API.ChangeQuery($"{keyword}{Plugin.Query.TermSeparator}");
|
||||
return false;
|
||||
}
|
||||
};
|
||||
var results =
|
||||
from keyword in PluginManager.NonGlobalPlugins.Keys
|
||||
let metadata = PluginManager.NonGlobalPlugins[keyword].Metadata
|
||||
where (context.API.FuzzySearch(query.Search, keyword).IsSearchPrecisionScoreMet()
|
||||
|| context.API.FuzzySearch(query.Search, metadata.Name).IsSearchPrecisionScoreMet()
|
||||
|| string.IsNullOrEmpty(query.Search)) // To list all available action keywords
|
||||
&& !metadata.Disabled
|
||||
select new Result
|
||||
{
|
||||
Title = keyword,
|
||||
SubTitle = string.Format(context.API.GetTranslation("flowlauncher_plugin_pluginindicator_result_subtitle"), metadata.Name),
|
||||
Score = 100,
|
||||
IcoPath = metadata.IcoPath,
|
||||
AutoCompleteText = $"{keyword}{Plugin.Query.TermSeparator}",
|
||||
Action = c =>
|
||||
{
|
||||
context.API.ChangeQuery($"{keyword}{Plugin.Query.TermSeparator}");
|
||||
return false;
|
||||
}
|
||||
};
|
||||
return results.ToList();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
"Name": "Plugin Indicator",
|
||||
"Description": "Provide plugin actionword suggestion",
|
||||
"Author": "qianlifeng",
|
||||
"Version": "2.0.0",
|
||||
"Version": "2.0.1",
|
||||
"Language": "csharp",
|
||||
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
|
||||
"ExecuteFileName": "Flow.Launcher.Plugin.PluginIndicator.dll",
|
||||
|
|
|
|||
Loading…
Reference in a new issue