Skip to content

Commit e204a09

Browse files
authored
Merge pull request #164 from Flow-Launcher/sort_plugin_processkiller_results
Sort plugin ProcessKiller's results ascending
2 parents ef19bb8 + f5acb9c commit e204a09

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
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
}

Plugins/Flow.Launcher.Plugin.ProcessKiller/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"Name":"Process Killer",
55
"Description":"kill running processes from Flow",
66
"Author":"Flow-Launcher",
7-
"Version":"1.0.0",
7+
"Version":"1.1.0",
88
"Language":"csharp",
99
"Website":"https://github.com/Flow-Launcher/Flow.Launcher.Plugin.ProcessKiller",
1010
"IcoPath":"Images\\app.png",

0 commit comments

Comments
 (0)