Skip to content

Commit b1ca71b

Browse files
committed
plugin/pkiller: improve kill-all option
- better title, add count of matches in subtitle, use process icon - hide option when executable path is empty
1 parent 01f98b1 commit b1ca71b

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

Plugins/Flow.Launcher.Plugin.ProcessKiller/Languages/en.xaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
<system:String x:Key="flowlauncher_plugin_processkiller_plugin_name">Process Killer</system:String>
66
<system:String x:Key="flowlauncher_plugin_processkiller_plugin_description">Kill running processes from Flow Launcher</system:String>
77

8-
<system:String x:Key="flowlauncher_plugin_processkiller_kill_all">kill all "{0}" processes</system:String>
8+
<system:String x:Key="flowlauncher_plugin_processkiller_kill_all">kill all instances of "{0}"</system:String>
9+
<system:String x:Key="flowlauncher_plugin_processkiller_kill_all_count">kill {0} processes</system:String>
910
<system:String x:Key="flowlauncher_plugin_processkiller_kill_instances">kill all instances</system:String>
1011

1112
</ResourceDictionary>

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ private List<Result> CreateResultsFromProcesses(List<ProcessResult> processlist,
8989
SubTitle = path,
9090
TitleHighlightData = StringMatcher.FuzzySearch(termToSearch, p.ProcessName).MatchData,
9191
Score = pr.Score,
92+
ContextData = p.ProcessName,
9293
Action = (c) =>
9394
{
9495
processHelper.TryKill(p);
@@ -101,14 +102,14 @@ private List<Result> CreateResultsFromProcesses(List<ProcessResult> processlist,
101102

102103
// When there are multiple results AND all of them are instances of the same executable
103104
// add a quick option to kill them all at the top of the results.
104-
var firstResult = sortedResults.FirstOrDefault()?.SubTitle;
105-
if (processlist.Count > 1 && !string.IsNullOrEmpty(termToSearch) && sortedResults.All(r => r.SubTitle == firstResult))
105+
var firstResult = sortedResults.FirstOrDefault(x => !string.IsNullOrEmpty(x.SubTitle));
106+
if (processlist.Count > 1 && !string.IsNullOrEmpty(termToSearch) && sortedResults.All(r => r.SubTitle == firstResult?.SubTitle))
106107
{
107108
sortedResults.Insert(1, new Result()
108109
{
109-
IcoPath = "Images/app.png",
110-
Title = string.Format(_context.API.GetTranslation("flowlauncher_plugin_processkiller_kill_all"), termToSearch),
111-
SubTitle = "",
110+
IcoPath = firstResult?.IcoPath,
111+
Title = string.Format(_context.API.GetTranslation("flowlauncher_plugin_processkiller_kill_all"), firstResult?.ContextData),
112+
SubTitle = string.Format(_context.API.GetTranslation("flowlauncher_plugin_processkiller_kill_all_count"), processlist.Count),
112113
Score = 200,
113114
Action = (c) =>
114115
{

0 commit comments

Comments
 (0)