ProcessKiller: change condition for batch kill

To avoid killing processes by mistake, only give the option to kill all
displayed processes when they are all instances of the same executable.
This commit is contained in:
Ioannis G 2020-07-03 02:10:41 +03:00
parent 563bf4d797
commit 10ce003dac
No known key found for this signature in database
GPG key ID: EAC0E4E5E36AC49E

View file

@ -81,7 +81,10 @@ namespace Flow.Launcher.Plugin.ProcessKiller
});
}
if (processlist.Count > 1 && !string.IsNullOrEmpty(termToSearch))
// When there are multiple results AND all of them are instances of the same executable
// add a quick option to kill them all at the top of the results.
var firstResult = results.FirstOrDefault()?.SubTitle;
if (processlist.Count > 1 && !string.IsNullOrEmpty(termToSearch) && results.All(r => r.SubTitle == firstResult))
{
results.Insert(0, new Result()
{