From 0cbd7ba1e2f422ee98960ea4bf2e0ff35633bde0 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Tue, 15 Apr 2025 23:42:08 +0800 Subject: [PATCH] Improve option logic --- .../Main.cs | 36 ++++++++++++++----- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.ProcessKiller/Main.cs b/Plugins/Flow.Launcher.Plugin.ProcessKiller/Main.cs index 3f505139a..8f5ba4bd2 100644 --- a/Plugins/Flow.Launcher.Plugin.ProcessKiller/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.ProcessKiller/Main.cs @@ -81,7 +81,8 @@ namespace Flow.Launcher.Plugin.ProcessKiller // Filter processes based on search term var searchTerm = query.Search; var processlist = new List(); - var processWindowTitle = Settings.ShowWindowTitle ? + var processWindowTitle = + Settings.ShowWindowTitle || Settings.PutVisibleWindowProcessesTop ? ProcessHelper.GetProcessesWithNonEmptyWindowTitle() : new Dictionary(); if (string.IsNullOrWhiteSpace(searchTerm)) @@ -93,12 +94,22 @@ namespace Flow.Launcher.Plugin.ProcessKiller if (processWindowTitle.TryGetValue(p.Id, out var windowTitle)) { // Add score to prioritize processes with visible windows - // And use window title for those processes - processlist.Add(new ProcessResult(p, Settings.PutVisibleWindowProcessesTop ? 200 : 0, windowTitle, null, progressNameIdTitle)); + // Use window title for those processes if enabled + processlist.Add(new ProcessResult( + p, + Settings.PutVisibleWindowProcessesTop ? 200 : 0, + Settings.ShowWindowTitle ? windowTitle : progressNameIdTitle, + null, + progressNameIdTitle)); } else { - processlist.Add(new ProcessResult(p, 0, progressNameIdTitle, null, progressNameIdTitle)); + processlist.Add(new ProcessResult( + p, + 0, + progressNameIdTitle, + null, + progressNameIdTitle)); } } } @@ -117,13 +128,17 @@ namespace Flow.Launcher.Plugin.ProcessKiller if (score > 0) { // Add score to prioritize processes with visible windows - // And use window title for those processes + // Use window title for those processes if (Settings.PutVisibleWindowProcessesTop) { score += 200; } - processlist.Add(new ProcessResult(p, score, windowTitle, - score == windowTitleMatch.Score ? windowTitleMatch : null, progressNameIdTitle)); + processlist.Add(new ProcessResult( + p, + score, + Settings.ShowWindowTitle ? windowTitle : progressNameIdTitle, + score == windowTitleMatch.Score ? windowTitleMatch : null, + progressNameIdTitle)); } } else @@ -132,7 +147,12 @@ namespace Flow.Launcher.Plugin.ProcessKiller var score = processNameIdMatch.Score; if (score > 0) { - processlist.Add(new ProcessResult(p, score, progressNameIdTitle, processNameIdMatch, progressNameIdTitle)); + processlist.Add(new ProcessResult( + p, + score, + progressNameIdTitle, + processNameIdMatch, + progressNameIdTitle)); } } }