mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Use IPluginHotkey for plugin manager plugin
This commit is contained in:
parent
030a7f31c2
commit
854f8082b1
2 changed files with 34 additions and 15 deletions
|
|
@ -1,14 +1,14 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Controls;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Controls;
|
||||
using Flow.Launcher.Plugin.PluginsManager.ViewModels;
|
||||
using Flow.Launcher.Plugin.PluginsManager.Views;
|
||||
|
||||
namespace Flow.Launcher.Plugin.PluginsManager
|
||||
{
|
||||
public class Main : ISettingProvider, IAsyncPlugin, IContextMenu, IPluginI18n
|
||||
public class Main : ISettingProvider, IAsyncPlugin, IContextMenu, IPluginI18n, IPluginHotkey
|
||||
{
|
||||
internal static PluginInitContext Context { get; set; }
|
||||
|
||||
|
|
@ -69,5 +69,36 @@ namespace Flow.Launcher.Plugin.PluginsManager
|
|||
{
|
||||
return Context.API.GetTranslation("plugin_pluginsmanager_plugin_description");
|
||||
}
|
||||
|
||||
public List<BasePluginHotkey> GetPuginHotkeys()
|
||||
{
|
||||
return new List<BasePluginHotkey>
|
||||
{
|
||||
new SearchWindowPluginHotkey
|
||||
{
|
||||
Id = 0,
|
||||
Name = Context.API.GetTranslation("plugin_pluginsmanager_plugin_contextmenu_openwebsite_title"),
|
||||
Description = Context.API.GetTranslation("plugin_pluginsmanager_plugin_contextmenu_openwebsite_subtitle"),
|
||||
Glyph = new GlyphInfo(FontFamily: "/Resources/#Segoe Fluent Icons", Glyph: "\uEB41"),
|
||||
DefaultHotkey = "Ctrl+Enter",
|
||||
Editable = false,
|
||||
Visible = true,
|
||||
Action = (r) =>
|
||||
{
|
||||
if (r.ContextData is UserPlugin plugin)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(plugin.Website))
|
||||
{
|
||||
Context.API.OpenUrl(plugin.Website);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -527,12 +527,6 @@ namespace Flow.Launcher.Plugin.PluginsManager
|
|||
IcoPath = icoPath,
|
||||
Action = e =>
|
||||
{
|
||||
if (e.SpecialKeyState.CtrlPressed)
|
||||
{
|
||||
SearchWeb.OpenInBrowserTab(plugin.UrlDownload);
|
||||
return ShouldHideWindow;
|
||||
}
|
||||
|
||||
if (Settings.WarnFromUnknownSource)
|
||||
{
|
||||
if (!InstallSourceKnown(plugin.UrlDownload)
|
||||
|
|
@ -633,12 +627,6 @@ namespace Flow.Launcher.Plugin.PluginsManager
|
|||
IcoPath = x.IcoPath,
|
||||
Action = e =>
|
||||
{
|
||||
if (e.SpecialKeyState.CtrlPressed)
|
||||
{
|
||||
SearchWeb.OpenInBrowserTab(x.Website);
|
||||
return ShouldHideWindow;
|
||||
}
|
||||
|
||||
Context.API.HideMainWindow();
|
||||
_ = InstallOrUpdateAsync(x); // No need to wait
|
||||
return ShouldHideWindow;
|
||||
|
|
|
|||
Loading…
Reference in a new issue