Skip to content

Commit 2d45a79

Browse files
committed
sort ProcessKiller plugin's results ascending
1 parent ec5f727 commit 2d45a79

File tree

1 file changed

+6
-4
lines changed
  • Plugins/Flow.Launcher.Plugin.ProcessKiller

1 file changed

+6
-4
lines changed

Plugins/Flow.Launcher.Plugin.ProcessKiller/Main.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,14 @@ private List<Result> CreateResultsFromProcesses(List<ProcessResult> processlist,
9494
});
9595
}
9696

97+
var sortedResults = results.OrderBy(x => x.Title).ToList();
98+
9799
// When there are multiple results AND all of them are instances of the same executable
98100
// add a quick option to kill them all at the top of the results.
99-
var firstResult = results.FirstOrDefault()?.SubTitle;
100-
if (processlist.Count > 1 && !string.IsNullOrEmpty(termToSearch) && results.All(r => r.SubTitle == firstResult))
101+
var firstResult = sortedResults.FirstOrDefault()?.SubTitle;
102+
if (processlist.Count > 1 && !string.IsNullOrEmpty(termToSearch) && sortedResults.All(r => r.SubTitle == firstResult))
101103
{
102-
results.Insert(0, new Result()
104+
sortedResults.Insert(1, new Result()
103105
{
104106
IcoPath = "Images/app.png",
105107
Title = string.Format(_context.API.GetTranslation("flowlauncher_plugin_processkiller_kill_all"), termToSearch),
@@ -117,7 +119,7 @@ private List<Result> CreateResultsFromProcesses(List<ProcessResult> processlist,
117119
});
118120
}
119121

120-
return results;
122+
return sortedResults;
121123
}
122124
}
123125
}

0 commit comments

Comments
 (0)