mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
* Merge pull request #1061 from Flow-Launcher/remove_winget_ci * Merge pull request #991 from Flow-Launcher/context_menu_plugin_site * Merge pull request #1080 from gissehel/caret-position-fix * Caret position fix : Include PR #1074 * Merge pull request #1283 from nachmore/dev * Merge pull request #1296 from nachmore/bug_1284 * Merge pull request #1294 from Flow-Launcher/pluginInfoMultipleActionKeyword * Merge pull request #1299 from nachmore/bug_1269 * Plugin Exception Draft (#1147) * Merge pull request #1355 from onesounds/LimitWidth * Merge pull request #1088 from Flow-Launcher/add_spanish_latin_america * Merge pull request #1387 from Flow-Launcher/fix_exception_duplicate_url_opening * Merge pull request #1390 from Flow-Launcher/issue_1371 * Merge pull request #1391 from Flow-Launcher/issue_1366
52 lines
1.9 KiB
C#
52 lines
1.9 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Flow.Launcher.Core.Plugin;
|
|
|
|
namespace Flow.Launcher.Plugin.PluginIndicator
|
|
{
|
|
public class Main : IPlugin, IPluginI18n
|
|
{
|
|
private PluginInitContext context;
|
|
|
|
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,
|
|
Action = c =>
|
|
{
|
|
context.API.ChangeQuery($"{keyword}{Plugin.Query.TermSeparator}");
|
|
return false;
|
|
}
|
|
};
|
|
return results.ToList();
|
|
}
|
|
|
|
public void Init(PluginInitContext context)
|
|
{
|
|
this.context = context;
|
|
}
|
|
|
|
public string GetTranslatedPluginTitle()
|
|
{
|
|
return context.API.GetTranslation("flowlauncher_plugin_pluginindicator_plugin_name");
|
|
}
|
|
|
|
public string GetTranslatedPluginDescription()
|
|
{
|
|
return context.API.GetTranslation("flowlauncher_plugin_pluginindicator_plugin_description");
|
|
}
|
|
}
|
|
}
|