diff --git a/Plugins/Flow.Launcher.Plugin.Program/Main.cs b/Plugins/Flow.Launcher.Plugin.Program/Main.cs index d28845994..2596415ba 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Main.cs @@ -16,7 +16,7 @@ using Path = System.IO.Path; namespace Flow.Launcher.Plugin.Program { - public class Main : ISettingProvider, IAsyncPlugin, IPluginI18n, IContextMenu, IAsyncReloadable, IDisposable + public class Main : ISettingProvider, IAsyncPlugin, IPluginI18n, IContextMenu, IAsyncReloadable, IDisposable, IPluginHotkey { private static readonly string ClassName = nameof(Main); @@ -459,5 +459,59 @@ namespace Flow.Launcher.Plugin.Program { Win32.Dispose(); } + + public List GetPuginHotkeys() + { + return new List + { + new SearchWindowPluginHotkey() + { + Id = 0, + Name = Context.API.GetTranslation("flowlauncher_plugin_program_open_containing_folder"), + Glyph = new GlyphInfo(FontFamily: "/Resources/#Segoe Fluent Icons", Glyph: "\ue838"), + DefaultHotkey = "Ctrl+Enter", + Editable = false, + Visible = true, + Action = (r) => + { + if (r.ContextData is UWPPackage uwp) + { + Context.API.OpenDirectory(uwp.Location); + return true; + } + else if (r.ContextData is Win32 win32) + { + Context.API.OpenDirectory(win32.ParentDirectory, win32.FullPath); + return true; + } + + return false; + } + }, + // TODO: Do it after administrator mode PR + /*new SearchWindowPluginHotkey() + { + Id = 1, + Name = Context.API.GetTranslation("flowlauncher_plugin_program_run_as_administrator"), + Glyph = new GlyphInfo(FontFamily: "/Resources/#Segoe Fluent Icons", Glyph: "\uE7EF"), + DefaultHotkey = "Ctrl+Shift+Enter", + Editable = false, + Visible = true, + Action = (r) => + { + if (r.ContextData is UWPPackage uwp) + { + return true; + } + else if (r.ContextData is Win32 win32) + { + return true; + } + + return false; + } + },*/ + }; + } } } diff --git a/Plugins/Flow.Launcher.Plugin.Program/Programs/UWPPackage.cs b/Plugins/Flow.Launcher.Plugin.Program/Programs/UWPPackage.cs index cb33250e1..116717b2f 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Programs/UWPPackage.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Programs/UWPPackage.cs @@ -442,14 +442,6 @@ namespace Flow.Launcher.Plugin.Program.Programs ContextData = this, Action = e => { - // Ctrl + Enter to open containing folder - bool openFolder = e.SpecialKeyState.ToModifierKeys() == ModifierKeys.Control; - if (openFolder) - { - Main.Context.API.OpenDirectory(Location); - return true; - } - // Ctrl + Shift + Enter to run elevated bool elevated = e.SpecialKeyState.ToModifierKeys() == (ModifierKeys.Control | ModifierKeys.Shift); diff --git a/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs b/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs index a87b002d4..038257e47 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs @@ -185,14 +185,6 @@ namespace Flow.Launcher.Plugin.Program.Programs TitleToolTip = $"{title}\n{ExecutablePath}", Action = c => { - // Ctrl + Enter to open containing folder - bool openFolder = c.SpecialKeyState.ToModifierKeys() == ModifierKeys.Control; - if (openFolder) - { - Main.Context.API.OpenDirectory(ParentDirectory, FullPath); - return true; - } - // Ctrl + Shift + Enter to run as admin bool runAsAdmin = c.SpecialKeyState.ToModifierKeys() == (ModifierKeys.Control | ModifierKeys.Shift);