plugin/pkiller: fix context menu results

do not show the "kill all instances" context menu option when the
context menu itself is triggered from the "kill all X processes" result
This commit is contained in:
Ioannis G 2020-10-11 23:40:29 +03:00
parent 82ebbcb811
commit 01f98b16fa
No known key found for this signature in database
GPG key ID: EAC0E4E5E36AC49E

View file

@ -52,21 +52,24 @@ namespace Flow.Launcher.Plugin.ProcessKiller
// get all non-system processes whose file path matches that of the given result (processPath)
var similarProcesses = processHelper.GetSimilarProcesses(processPath);
menuOptions.Add(new Result
if (similarProcesses.Count() > 0)
{
Title = _context.API.GetTranslation("flowlauncher_plugin_processkiller_kill_instances"),
SubTitle = processPath,
Action = _ =>
menuOptions.Add(new Result
{
foreach (var p in similarProcesses)
Title = _context.API.GetTranslation("flowlauncher_plugin_processkiller_kill_instances"),
SubTitle = processPath,
Action = _ =>
{
processHelper.TryKill(p);
}
foreach (var p in similarProcesses)
{
processHelper.TryKill(p);
}
return true;
},
IcoPath = processPath
});
return true;
},
IcoPath = processPath
});
}
return menuOptions;
}