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
3 changes: 2 additions & 1 deletion .github/actions/spelling/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,5 @@ TSource
runas
dpi
popup
ptr
ptr
pluginindicator
Original file line number Diff line number Diff line change
Expand Up @@ -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>
44 changes: 22 additions & 22 deletions Plugins/Flow.Launcher.Plugin.PluginIndicator/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,28 @@ public class Main : IPlugin, IPluginI18n

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();
}

Expand Down
4 changes: 2 additions & 2 deletions Plugins/Flow.Launcher.Plugin.PluginIndicator/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down