Merge pull request #2170 from JohnTheGr8/kill_honor_last_query_style

plugin/ProcessKiller: honor "Last Query Style" after kill
This commit is contained in:
VictoriousRaptor 2023-06-04 12:36:51 +08:00 committed by GitHub
commit 22dd59eef8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 11 deletions

View file

@ -1,7 +1,6 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using Flow.Launcher.Infrastructure;
using System.Threading.Tasks;
namespace Flow.Launcher.Plugin.ProcessKiller
{
@ -89,7 +88,8 @@ namespace Flow.Launcher.Plugin.ProcessKiller
Action = (c) =>
{
processHelper.TryKill(p);
_ = DelayAndReQueryAsync(query.RawQuery); // Re-query after killing process to refresh process list
// Re-query to refresh process list
_context.API.ChangeQuery(query.RawQuery, true);
return true;
}
});
@ -114,7 +114,8 @@ namespace Flow.Launcher.Plugin.ProcessKiller
{
processHelper.TryKill(p.Process);
}
_ = DelayAndReQueryAsync(query.RawQuery); // Re-query after killing process to refresh process list
// Re-query to refresh process list
_context.API.ChangeQuery(query.RawQuery, true);
return true;
}
});
@ -122,11 +123,5 @@ namespace Flow.Launcher.Plugin.ProcessKiller
return sortedResults;
}
private static async Task DelayAndReQueryAsync(string query)
{
await Task.Delay(500);
_context.API.ChangeQuery(query, true);
}
}
}

View file

@ -1,4 +1,4 @@
using Flow.Launcher.Infrastructure;
using Flow.Launcher.Infrastructure;
using Flow.Launcher.Infrastructure.Logger;
using System;
using System.Collections.Generic;
@ -75,6 +75,7 @@ namespace Flow.Launcher.Plugin.ProcessKiller
if (!p.HasExited)
{
p.Kill();
p.WaitForExit(50);
}
}
catch (Exception e)