mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Merge pull request #1750 from Flow-Launcher/fix_pluginindicator_search
Allow plugin name to be searchable by Plugin Indicator
This commit is contained in:
commit
43b8cc5a7b
4 changed files with 30 additions and 27 deletions
3
.github/actions/spelling/expect.txt
vendored
3
.github/actions/spelling/expect.txt
vendored
|
|
@ -56,4 +56,5 @@ TSource
|
|||
runas
|
||||
dpi
|
||||
popup
|
||||
ptr
|
||||
ptr
|
||||
pluginindicator
|
||||
|
|
@ -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,28 @@ 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 plugin = PluginManager.NonGlobalPlugins[keyword].Metadata
|
||||
let keywordSearchResult = context.API.FuzzySearch(query.Search, keyword)
|
||||
let searchResult = keywordSearchResult.IsSearchPrecisionScoreMet() ? keywordSearchResult : context.API.FuzzySearch(query.Search, plugin.Name)
|
||||
let score = searchResult.Score
|
||||
where (searchResult.IsSearchPrecisionScoreMet()
|
||||
|| string.IsNullOrEmpty(query.Search)) // To list all available action keywords
|
||||
&& !plugin.Disabled
|
||||
select new Result
|
||||
{
|
||||
Title = keyword,
|
||||
SubTitle = string.Format(context.API.GetTranslation("flowlauncher_plugin_pluginindicator_result_subtitle"), plugin.Name),
|
||||
Score = score,
|
||||
IcoPath = plugin.IcoPath,
|
||||
AutoCompleteText = $"{keyword}{Plugin.Query.TermSeparator}",
|
||||
Action = c =>
|
||||
{
|
||||
context.API.ChangeQuery($"{keyword}{Plugin.Query.TermSeparator}");
|
||||
return false;
|
||||
}
|
||||
};
|
||||
return results.ToList();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
"ID": "6A122269676E40EB86EB543B945932B9",
|
||||
"ActionKeyword": "*",
|
||||
"Name": "Plugin Indicator",
|
||||
"Description": "Provide plugin actionword suggestion",
|
||||
"Description": "Provides plugin action keyword suggestions",
|
||||
"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