Add special ctrl for Pluginsmanager and Shell plugin

This commit is contained in:
弘韬 张 2021-05-15 02:17:57 +08:00
parent 41c3f8a793
commit d421a950f6
2 changed files with 11 additions and 5 deletions

View file

@ -319,6 +319,12 @@ namespace Flow.Launcher.Plugin.PluginsManager
IcoPath = icoPath,
Action = e =>
{
if (e.SpecialKeyState.CtrlPressed)
{
SearchWeb.NewTabInBrowser(x.Website);
return ShouldHideWindow;
}
Application.Current.MainWindow.Hide();
_ = InstallOrUpdate(x); // No need to wait
return ShouldHideWindow;

View file

@ -86,7 +86,7 @@ namespace Flow.Launcher.Plugin.Shell
IcoPath = Image,
Action = c =>
{
Execute(Process.Start, PrepareProcessStartInfo(m));
Execute(Process.Start, PrepareProcessStartInfo(m, c.SpecialKeyState.CtrlPressed));
return true;
}
}));
@ -182,7 +182,7 @@ namespace Flow.Launcher.Plugin.Shell
if (_settings.Shell == Shell.Cmd)
{
var arguments = _settings.LeaveShellOpen ? $"/k \"{command}\"" : $"/c \"{command}\" & pause";
info = ShellCommand.SetProcessStartInfo("cmd.exe", workingDirectory, arguments, runAsAdministratorArg);
}
else if (_settings.Shell == Shell.Powershell)
@ -232,11 +232,11 @@ namespace Flow.Launcher.Plugin.Shell
return info;
}
private void Execute(Func<ProcessStartInfo, Process> startProcess,ProcessStartInfo info)
private void Execute(Func<ProcessStartInfo, Process> startProcess, ProcessStartInfo info)
{
try
{
startProcess(info);
startProcess(info);
}
catch (FileNotFoundException e)
{
@ -244,7 +244,7 @@ namespace Flow.Launcher.Plugin.Shell
var message = $"Command not found: {e.Message}";
context.API.ShowMsg(name, message);
}
catch(Win32Exception e)
catch (Win32Exception e)
{
var name = "Plugin: Shell";
var message = $"Error running the command: {e.Message}";