diff --git a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs index d0fdf136b68..ad0bebb4b00 100644 --- a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs +++ b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs @@ -270,5 +270,11 @@ public interface IPublicAPI /// Non-C# plugins should use this method /// public void OpenAppUri(string appUri); + + /// + /// Get Settings.LastQueryMode + /// Possible return values: "Empty", "Selected", "Preserved" + /// + public string GetLastQueryMode(); } } diff --git a/Flow.Launcher/PublicAPIInstance.cs b/Flow.Launcher/PublicAPIInstance.cs index 800115bfae9..d5aaff36ebc 100644 --- a/Flow.Launcher/PublicAPIInstance.cs +++ b/Flow.Launcher/PublicAPIInstance.cs @@ -275,6 +275,11 @@ public void OpenAppUri(Uri appUri) public void RegisterGlobalKeyboardCallback(Func callback) => _globalKeyboardHandlers.Add(callback); public void RemoveGlobalKeyboardCallback(Func callback) => _globalKeyboardHandlers.Remove(callback); + public string GetLastQueryMode() + { + return _settingsVM.Settings.LastQueryMode.ToString(); + } + #endregion #region Private Methods diff --git a/Plugins/Flow.Launcher.Plugin.ProcessKiller/Main.cs b/Plugins/Flow.Launcher.Plugin.ProcessKiller/Main.cs index 3eff7e3984d..9f761a5a972 100644 --- a/Plugins/Flow.Launcher.Plugin.ProcessKiller/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.ProcessKiller/Main.cs @@ -65,7 +65,7 @@ private List CreateResultsFromQuery(Query query) { string termToSearch = query.Search; var processlist = processHelper.GetMatchingProcesses(termToSearch); - + if (!processlist.Any()) { return null; @@ -89,7 +89,10 @@ private List CreateResultsFromQuery(Query query) Action = (c) => { processHelper.TryKill(p); - _ = DelayAndReQueryAsync(query.RawQuery); // Re-query after killing process to refresh process list + if (_context.API.GetLastQueryMode() != "Empty") + { + _ = DelayAndReQueryAsync(query.RawQuery); // Re-query after killing process to refresh process list + } return true; } }); @@ -114,7 +117,10 @@ private List CreateResultsFromQuery(Query query) { processHelper.TryKill(p.Process); } - _ = DelayAndReQueryAsync(query.RawQuery); // Re-query after killing process to refresh process list + if (_context.API.GetLastQueryMode() != "Empty") + { + _ = DelayAndReQueryAsync(query.RawQuery); // Re-query after killing process to refresh process list + } return true; } });